KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > console > ConsoleView


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.console;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.HashMap JavaDoc;
15 import java.util.List JavaDoc;
16 import java.util.Map JavaDoc;
17
18 import org.eclipse.core.runtime.ISafeRunnable;
19 import org.eclipse.core.runtime.ListenerList;
20 import org.eclipse.core.runtime.SafeRunner;
21 import org.eclipse.jface.action.IToolBarManager;
22 import org.eclipse.jface.action.Separator;
23 import org.eclipse.jface.util.IPropertyChangeListener;
24 import org.eclipse.jface.util.PropertyChangeEvent;
25 import org.eclipse.jface.viewers.IBasicPropertyConstants;
26 import org.eclipse.swt.widgets.Composite;
27 import org.eclipse.ui.IPartListener2;
28 import org.eclipse.ui.IViewReference;
29 import org.eclipse.ui.IViewSite;
30 import org.eclipse.ui.IWorkbenchPart;
31 import org.eclipse.ui.IWorkbenchPartReference;
32 import org.eclipse.ui.PlatformUI;
33 import org.eclipse.ui.console.AbstractConsole;
34 import org.eclipse.ui.console.ConsolePlugin;
35 import org.eclipse.ui.console.IConsole;
36 import org.eclipse.ui.console.IConsoleConstants;
37 import org.eclipse.ui.console.IConsoleListener;
38 import org.eclipse.ui.console.IConsoleManager;
39 import org.eclipse.ui.console.IConsolePageParticipant;
40 import org.eclipse.ui.console.IConsoleView;
41 import org.eclipse.ui.part.IPage;
42 import org.eclipse.ui.part.IPageBookViewPage;
43 import org.eclipse.ui.part.MessagePage;
44 import org.eclipse.ui.part.PageBook;
45 import org.eclipse.ui.part.PageBookView;
46 import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
47
48 /**
49  * Page book console view.
50  *
51  * @since 3.0
52  */

53 public class ConsoleView extends PageBookView implements IConsoleView, IConsoleListener, IPropertyChangeListener, IPartListener2 {
54     
55     /**
56      * Whether this console is pinned.
57      */

58     private boolean fPinned = false;
59     
60     /**
61      * Stack of consoles in MRU order
62      */

63     private List JavaDoc fStack = new ArrayList JavaDoc();
64     
65     /**
66      * The console being displayed, or <code>null</code> if none
67      */

68     private IConsole fActiveConsole = null;
69     
70     /**
71      * Map of consoles to dummy console parts (used to close pages)
72      */

73     private Map JavaDoc fConsoleToPart;
74     
75     /**
76      * Map of consoles to array of page participants
77      */

78     private Map JavaDoc fConsoleToPageParticipants;
79     
80     /**
81      * Map of parts to consoles
82      */

83     private Map JavaDoc fPartToConsole;
84     
85     /**
86      * Whether this view is active
87      */

88     private boolean fActive = false;
89     
90     // actions
91
private PinConsoleAction fPinAction = null;
92     private ConsoleDropDownAction fDisplayConsoleAction = null;
93     
94     private OpenConsoleAction fOpenConsoleAction = null;
95
96     private boolean fScrollLock;
97
98     private boolean isAvailable() {
99         return getPageBook() != null && !getPageBook().isDisposed();
100     }
101
102     /* (non-Javadoc)
103      * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
104      */

105     public void propertyChange(PropertyChangeEvent event) {
106         Object JavaDoc source = event.getSource();
107         if (source instanceof IConsole && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
108             if (source.equals(getConsole())) {
109                 updateTitle();
110             }
111         }
112
113     }
114
115     /* (non-Javadoc)
116      * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
117      */

118     public void partClosed(IWorkbenchPart part) {
119         super.partClosed(part);
120         fPinAction.update();
121     }
122
123     /* (non-Javadoc)
124      * @see org.eclipse.debug.internal.ui.console.IConsoleView#getConsole()
125      */

126     public IConsole getConsole() {
127         return fActiveConsole;
128     }
129
130     /* (non-Javadoc)
131      * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
132      */

133     protected void showPageRec(PageRec pageRec) {
134         // don't show the page when pinned, unless this is the first console to be added
135
// or its the default page
136
if (fActiveConsole != null && pageRec.page != getDefaultPage() && fPinned && fConsoleToPart.size() > 1) {
137             IConsole console = (IConsole)fPartToConsole.get(pageRec.part);
138             if (!fStack.contains(console)) {
139                 fStack.add(console);
140             }
141             return;
142         }
143         
144         IConsole recConsole = (IConsole)fPartToConsole.get(pageRec.part);
145         if (recConsole!=null && recConsole.equals(fActiveConsole)) {
146             return;
147         }
148         
149         super.showPageRec(pageRec);
150         fActiveConsole = recConsole;
151         IConsole tos = null;
152         if (!fStack.isEmpty()) {
153             tos = (IConsole) fStack.get(0);
154         }
155         if (tos != null && !tos.equals(fActiveConsole)) {
156             deactivateParticipants(tos);
157         }
158         if (fActiveConsole != null && !fActiveConsole.equals(tos)) {
159             fStack.remove(fActiveConsole);
160             fStack.add(0,fActiveConsole);
161             activateParticipants(fActiveConsole);
162         }
163         updateTitle();
164         updateHelp();
165         // update console actions
166
if (fPinAction != null) {
167             fPinAction.update();
168         }
169         IPage page = getCurrentPage();
170         if (page instanceof IOConsolePage) {
171             ((IOConsolePage)page).setAutoScroll(!fScrollLock);
172         }
173     }
174     
175     /**
176      * Activates the participants for the given console, if any.
177      *
178      * @param console
179      */

180     private void activateParticipants(IConsole console) {
181         // activate
182
if (console != null && fActive) {
183             final ListenerList listeners = getParticipants(console);
184             if (listeners != null) {
185                 Object JavaDoc[] participants = listeners.getListeners();
186                 for (int i = 0; i < participants.length; i++) {
187                     final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
188                     SafeRunner.run(new ISafeRunnable() {
189                         public void run() throws Exception JavaDoc {
190                             participant.activated();
191                         }
192                         public void handleException(Throwable JavaDoc exception) {
193                             ConsolePlugin.log(exception);
194                             listeners.remove(participant);
195                         }
196                     });
197                 }
198             }
199         }
200     }
201
202     /**
203      * Returns a stack of consoles in the view in MRU order.
204      *
205      * @return a stack of consoles in the view in MRU order
206      */

207     protected List JavaDoc getConsoleStack() {
208         return fStack;
209     }
210
211     /**
212      * Updates the view title based on the active console
213      */

214     protected void updateTitle() {
215         IConsole console = getConsole();
216         if (console == null) {
217             setContentDescription(ConsoleMessages.ConsoleView_0);
218         } else {
219             String JavaDoc newName = console.getName();
220             String JavaDoc oldName = getContentDescription();
221             if (newName!=null && !(newName.equals(oldName))) {
222                 setContentDescription(console.getName());
223             }
224         }
225     }
226     
227     protected void updateHelp() {
228         IConsole console = getConsole();
229         String JavaDoc helpContextId = null;
230         if (console instanceof AbstractConsole) {
231             AbstractConsole abs = (AbstractConsole) console;
232             helpContextId = abs.getHelpContextId();
233         }
234         if (helpContextId == null) {
235             helpContextId = IConsoleHelpContextIds.CONSOLE_VIEW;
236         }
237         PlatformUI.getWorkbench().getHelpSystem().setHelp(getPageBook().getParent(), helpContextId);
238     }
239
240     /* (non-Javadoc)
241      * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
242      */

243     protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
244         IConsole console = (IConsole)fPartToConsole.get(part);
245         
246         // dispose page participants
247
ListenerList listeners = (ListenerList) fConsoleToPageParticipants.remove(console);
248         if (listeners != null) {
249             Object JavaDoc[] participants = listeners.getListeners();
250             for (int i = 0; i < participants.length; i++) {
251                 final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
252                 SafeRunner.run(new ISafeRunnable() {
253                     public void run() throws Exception JavaDoc {
254                         participant.dispose();
255                     }
256                     public void handleException(Throwable JavaDoc exception) {
257                         ConsolePlugin.log(exception);
258                     }
259                 });
260             }
261         }
262
263         IPage page = pageRecord.page;
264         page.dispose();
265         pageRecord.dispose();
266         console.removePropertyChangeListener(this);
267                         
268         // empty cross-reference cache
269
fPartToConsole.remove(part);
270         fConsoleToPart.remove(console);
271         if (fPartToConsole.isEmpty()) {
272             fActiveConsole = null;
273         }
274         
275         // update console actions
276
fPinAction.update();
277     }
278     
279     /**
280      * Returns the page participants registered for the given console, or <code>null</code>
281      *
282      * @param console
283      * @return registered page participants or <code>null</code>
284      */

285     private ListenerList getParticipants(IConsole console) {
286         return (ListenerList) fConsoleToPageParticipants.get(console);
287     }
288
289     /* (non-Javadoc)
290      * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
291      */

292     protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
293         ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)dummyPart;
294         final IConsole console = part.getConsole();
295         final IPageBookViewPage page = console.createPage(this);
296         initPage(page);
297         page.createControl(getPageBook());
298         console.addPropertyChangeListener(this);
299         
300         // initialize page participants
301
IConsolePageParticipant[] consoleParticipants = ((ConsoleManager)getConsoleManager()).getPageParticipants(console);
302         final ListenerList participants = new ListenerList();
303         for (int i = 0; i < consoleParticipants.length; i++) {
304             participants.add(consoleParticipants[i]);
305         }
306         fConsoleToPageParticipants.put(console, participants);
307         Object JavaDoc[] listeners = participants.getListeners();
308         for (int i = 0; i < listeners.length; i++) {
309             final IConsolePageParticipant participant = (IConsolePageParticipant) listeners[i];
310             SafeRunner.run(new ISafeRunnable() {
311                 public void run() throws Exception JavaDoc {
312                     participant.init(page, console);
313                 }
314                 public void handleException(Throwable JavaDoc exception) {
315                     ConsolePlugin.log(exception);
316                     participants.remove(participant);
317                 }
318             });
319         }
320         
321         PageRec rec = new PageRec(dummyPart, page);
322         return rec;
323     }
324
325     /* (non-Javadoc)
326      * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
327      */

328     protected boolean isImportant(IWorkbenchPart part) {
329         return part instanceof ConsoleWorkbenchPart;
330     }
331
332     /* (non-Javadoc)
333      * @see org.eclipse.ui.IWorkbenchPart#dispose()
334      */

335     public void dispose() {
336         super.dispose();
337         getViewSite().getPage().removePartListener((IPartListener2)this);
338         ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
339         consoleManager.removeConsoleListener(this);
340         consoleManager.unregisterConsoleView(this);
341     }
342
343     /**
344      * Returns the console manager.
345      *
346      * @return the console manager
347      */

348     private IConsoleManager getConsoleManager() {
349         return ConsolePlugin.getDefault().getConsoleManager();
350     }
351
352     /* (non-Javadoc)
353      * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
354      */

355     protected IPage createDefaultPage(PageBook book) {
356         MessagePage page = new MessagePage();
357         page.createControl(getPageBook());
358         initPage(page);
359         return page;
360     }
361
362     /* (non-Javadoc)
363      * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
364      */

365     public void consolesAdded(final IConsole[] consoles) {
366         if (isAvailable()) {
367             Runnable JavaDoc r = new Runnable JavaDoc() {
368                 public void run() {
369                     for (int i = 0; i < consoles.length; i++) {
370                         if (isAvailable()) {
371                             IConsole console = consoles[i];
372                             // ensure it's still registered since this is done asynchronously
373
IConsole[] allConsoles = getConsoleManager().getConsoles();
374                             for (int j = 0; j < allConsoles.length; j++) {
375                                 IConsole registered = allConsoles[j];
376                                 if (registered.equals(console)) {
377                                     ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
378                                     fConsoleToPart.put(console, part);
379                                     fPartToConsole.put(part, console);
380                                     partActivated(part);
381                                     break;
382                                 }
383                             }
384
385                         }
386                     }
387                 }
388             };
389             asyncExec(r);
390         }
391     }
392
393     /* (non-Javadoc)
394      * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
395      */

396     public void consolesRemoved(final IConsole[] consoles) {
397         if (isAvailable()) {
398             Runnable JavaDoc r = new Runnable JavaDoc() {
399                 public void run() {
400                     for (int i = 0; i < consoles.length; i++) {
401                         if (isAvailable()) {
402                             IConsole console = consoles[i];
403                             fStack.remove(console);
404                             ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
405                             if (part != null) {
406                                 partClosed(part);
407                             }
408                             if (getConsole() == null) {
409                                 IConsole[] available = getConsoleManager().getConsoles();
410                                 if (available.length > 0) {
411                                     display(available[available.length - 1]);
412                                 }
413                             }
414                         }
415                     }
416                 }
417             };
418             asyncExec(r);
419         }
420     }
421
422     /**
423      * Constructs a console view
424      */

425     public ConsoleView() {
426         super();
427         fConsoleToPart = new HashMap JavaDoc();
428         fPartToConsole = new HashMap JavaDoc();
429         fConsoleToPageParticipants = new HashMap JavaDoc();
430         
431         ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
432         consoleManager.registerConsoleView(this);
433     }
434     
435     protected void createActions() {
436         fPinAction = new PinConsoleAction(this);
437         fDisplayConsoleAction = new ConsoleDropDownAction(this);
438         ConsoleFactoryExtension[] extensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
439         if (extensions.length > 0) {
440             fOpenConsoleAction = new OpenConsoleAction();
441         }
442     }
443
444     protected void configureToolBar(IToolBarManager mgr) {
445         mgr.add(new Separator(IConsoleConstants.LAUNCH_GROUP));
446         mgr.add(new Separator(IConsoleConstants.OUTPUT_GROUP));
447         mgr.add(new Separator("fixedGroup")); //$NON-NLS-1$
448
mgr.add(fPinAction);
449         mgr.add(fDisplayConsoleAction);
450         if (fOpenConsoleAction != null) {
451             mgr.add(fOpenConsoleAction);
452         }
453     }
454
455     /* (non-Javadoc)
456      * @see org.eclipse.ui.console.IConsoleView#display(org.eclipse.ui.console.IConsole)
457      */

458     public void display(IConsole console) {
459         if (fPinned && fActiveConsole != null) {
460             return;
461         }
462         if (console.equals(fActiveConsole)) {
463             return;
464         }
465         ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
466         if (part != null) {
467             partActivated(part);
468         }
469     }
470
471     /*/* (non-Javadoc)
472      * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
473      */

474     public void setPinned(boolean pin) {
475         fPinned = pin;
476         if (fPinAction != null) {
477             fPinAction.update();
478         }
479     }
480
481     /* (non-Javadoc)
482      * @see org.eclipse.ui.console.IConsoleView#isPinned()
483      */

484     public boolean isPinned() {
485         return fPinned;
486     }
487
488     /* (non-Javadoc)
489      * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
490      */

491     protected IWorkbenchPart getBootstrapPart() {
492         return null;
493     }
494     
495     /**
496      * Registers the given runnable with the display
497      * associated with this view's control, if any.
498      *
499      * @see org.eclipse.swt.widgets.Display#asyncExec(java.lang.Runnable)
500      */

501     public void asyncExec(Runnable JavaDoc r) {
502         if (isAvailable()) {
503             getPageBook().getDisplay().asyncExec(r);
504         }
505     }
506     
507     /**
508      * Creates this view's underlying viewer and actions.
509      * Hooks a pop-up menu to the underlying viewer's control,
510      * as well as a key listener. When the delete key is pressed,
511      * the <code>REMOVE_ACTION</code> is invoked. Hooks help to
512      * this view. Subclasses must implement the following methods
513      * which are called in the following order when a view is
514      * created:<ul>
515      * <li><code>createViewer(Composite)</code> - the context
516      * menu is hooked to the viewer's control.</li>
517      * <li><code>createActions()</code></li>
518      * <li><code>configureToolBar(IToolBarManager)</code></li>
519      * <li><code>getHelpContextId()</code></li>
520      * </ul>
521      * @see IWorkbenchPart#createPartControl(Composite)
522      */

523     public void createPartControl(Composite parent) {
524         super.createPartControl(parent);
525         createActions();
526         IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
527         configureToolBar(tbm);
528         updateForExistingConsoles();
529         getViewSite().getActionBars().updateActionBars();
530         PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW);
531         getViewSite().getPage().addPartListener((IPartListener2)this);
532     }
533     
534     /**
535      * Initialize for existing consoles
536      */

537     private void updateForExistingConsoles() {
538         IConsoleManager manager = getConsoleManager();
539         // create pages for consoles
540
IConsole[] consoles = manager.getConsoles();
541         consolesAdded(consoles);
542         // add as a listener
543
manager.addConsoleListener(this);
544     }
545     
546     /* (non-Javadoc)
547      * @see org.eclipse.ui.console.IConsoleView#warnOfContentChange(org.eclipse.ui.console.IConsole)
548      */

549     public void warnOfContentChange(IConsole console) {
550         IWorkbenchPart part = (IWorkbenchPart)fConsoleToPart.get(console);
551         if (part != null) {
552             IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) part.getSite().getAdapter(IWorkbenchSiteProgressService.class);
553             if (service != null) {
554                 service.warnOfContentChange();
555             }
556         }
557     }
558     
559     public Object JavaDoc getAdapter(Class JavaDoc key) {
560         Object JavaDoc adpater = super.getAdapter(key);
561         if (adpater == null) {
562             IConsole console = getConsole();
563             if (console != null) {
564                 ListenerList listeners = getParticipants(console);
565                 // an adapter can be asked for before the console participants are created
566
if (listeners != null) {
567                     Object JavaDoc[] participants = listeners.getListeners();
568                     for (int i = 0; i < participants.length; i++) {
569                         IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
570                         adpater = participant.getAdapter(key);
571                         if (adpater != null) {
572                             return adpater;
573                         }
574                     }
575                 }
576             }
577         }
578         return adpater;
579     }
580
581     /* (non-Javadoc)
582      * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
583      */

584     public void partActivated(IWorkbenchPartReference partRef) {
585         if (isThisPart(partRef)) {
586             fActive = true;
587             activateParticipants(fActiveConsole);
588         }
589     }
590
591     /* (non-Javadoc)
592      * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
593      */

594     public void partBroughtToTop(IWorkbenchPartReference partRef) {
595     }
596
597     /* (non-Javadoc)
598      * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
599      */

600     public void partClosed(IWorkbenchPartReference partRef) {
601     }
602
603     /* (non-Javadoc)
604      * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
605      */

606     public void partDeactivated(IWorkbenchPartReference partRef) {
607         if (isThisPart(partRef)) {
608             fActive = false;
609             deactivateParticipants(fActiveConsole);
610         }
611     }
612     
613     protected boolean isThisPart(IWorkbenchPartReference partRef) {
614         if (partRef instanceof IViewReference) {
615             IViewReference viewRef = (IViewReference) partRef;
616             if (viewRef.getId().equals(getViewSite().getId())) {
617                 String JavaDoc secId = viewRef.getSecondaryId();
618                 String JavaDoc mySec = null;
619                 if (getSite() instanceof IViewSite) {
620                     mySec = ((IViewSite)getSite()).getSecondaryId();
621                 }
622                 if (mySec == null) {
623                     return secId == null;
624                 }
625                 return mySec.equals(secId);
626             }
627         }
628         return false;
629     }
630
631     /**
632      * Deactivates participants for the given console, if any.
633      *
634      * @param console console to deactivate
635      */

636     private void deactivateParticipants(IConsole console) {
637         // deactivate
638
if (console != null) {
639             final ListenerList listeners = getParticipants(console);
640             if (listeners != null) {
641                 Object JavaDoc[] participants = listeners.getListeners();
642                 for (int i = 0; i < participants.length; i++) {
643                     final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
644                     SafeRunner.run(new ISafeRunnable() {
645                         public void run() throws Exception JavaDoc {
646                             participant.deactivated();
647                         }
648                         public void handleException(Throwable JavaDoc exception) {
649                             ConsolePlugin.log(exception);
650                             listeners.remove(participant);
651                         }
652                     });
653                 }
654             }
655         }
656     }
657
658     /* (non-Javadoc)
659      * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
660      */

661     public void partOpened(IWorkbenchPartReference partRef) {
662     }
663
664     /* (non-Javadoc)
665      * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
666      */

667     public void partHidden(IWorkbenchPartReference partRef) {
668     }
669
670     /* (non-Javadoc)
671      * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
672      */

673     public void partVisible(IWorkbenchPartReference partRef) {
674     }
675
676     /* (non-Javadoc)
677      * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
678      */

679     public void partInputChanged(IWorkbenchPartReference partRef) {
680     }
681
682     /* (non-Javadoc)
683      * @see org.eclipse.ui.console.IConsoleView#setScrollLock(boolean)
684      */

685     public void setScrollLock(boolean scrollLock) {
686         fScrollLock = scrollLock;
687
688         IPage page = getCurrentPage();
689         if (page instanceof IOConsolePage) {
690             ((IOConsolePage)page).setAutoScroll(!scrollLock);
691         }
692     }
693
694     /* (non-Javadoc)
695      * @see org.eclipse.ui.console.IConsoleView#getScrollLock()
696      */

697     public boolean getScrollLock() {
698         return fScrollLock;
699     }
700     
701     /* (non-Javadoc)
702      * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
703      */

704     public void pin(IConsole console) {
705         if (console == null) {
706             setPinned(false);
707         } else {
708             if (isPinned()) {
709                 setPinned(false);
710             }
711             display(console);
712             setPinned(true);
713         }
714     }
715 }
716
Popular Tags