下面列出了怎么用org.eclipse.ui.console.IConsoleConstants的API类实例代码及写法,或者点击链接到github查看源代码。
private void configureToolBar(IToolBarManager toolbarManager) {
terminateAction = new Action(Messages.actionStop) {
@Override
public void run() {
//code to execute when button is pressed
LocalAppEngineServerBehaviour serverBehaviour = console.getServerBehaviourDelegate();
if (serverBehaviour != null) {
// try to initiate a nice shutdown
boolean force = serverBehaviour.getServer().getServerState() == IServer.STATE_STOPPING;
serverBehaviour.stop(force);
}
update();
}
};
terminateAction.setToolTipText(Messages.actionStopToolTip);
terminateAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
terminateAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
terminateAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
}
@Override
public void createInitialLayout(IPageLayout layout) {
layout.addNewWizardShortcut("com.excelsior.xds.ui.project.NewProjectFromScratchWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("com.excelsior.xds.ui.project.NewProjectFromSourcesWizard"); //$NON-NLS-1$
String editorArea = layout.getEditorArea();
layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.20f, editorArea);
// the Tasks view.
IFolderLayout bottom =
layout.createFolder("bottom", IPageLayout.BOTTOM, 0.80f, editorArea); //$NON-NLS-1$
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, 0.80f, editorArea); //$NON-NLS-1$
right.addView(IPageLayout.ID_OUTLINE);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet("org.eclipse.debug.ui.profileActionSet"); //Bug: not included in IDebugUIConstants //$NON-NLS-1$
// Put the Outline view on the left.
// layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.01f, editorArea);
}
private void defineActions(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.26,
editorArea);
left.addView(IPageLayout.ID_PROJECT_EXPLORER);
IFolderLayout middleLeft = layout.createFolder("middleLeft", IPageLayout.BOTTOM, (float)
0.33, "left");
middleLeft.addView(ReportListView.ID);
middleLeft.addView(ReportListViewProject.ID);
IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, (float) 0.8,
editorArea);
right.addView(IConsoleConstants.ID_CONSOLE_VIEW);
right.addView(IPageLayout.ID_OUTLINE);
right.addView(IPageLayout.ID_TASK_LIST);
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.8,
editorArea);
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
}
@Override
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.25, editorArea); //$NON-NLS-1$
left.addView(IPageLayout.ID_PROJECT_EXPLORER);
left.addPlaceholder(IPageLayout.ID_RES_NAV);
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
bottom.addView("org.eclipse.tm.terminal.view.ui.TerminalsView");
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
bottom.addPlaceholder(TemplatesView.ID);
bottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
bottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
bottom.addPlaceholder(IPageLayout.ID_TASK_LIST);
bottom.addPlaceholder(IPageLayout.ID_PROP_SHEET);
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);
}
public void show() {
Runnable runnable = new Runnable() {
public void run() {
// this should only be called from GUI thread
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
CppcheclipsePlugin.logError("Could not show console because there is no active workbench window");
return;
}
IWorkbenchPage page = window.getActivePage();
if (page == null) {
CppcheclipsePlugin.logError("Could not show console because there is no active page");
return;
}
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(messageConsole);
} catch (PartInitException e) {
CppcheclipsePlugin.logError("Could not show console", e);
}
}
};
Display.getDefault().asyncExec(runnable);
}
public void createInitialLayout(IPageLayout layout)
{
// Get the editor area
String editorArea = layout.getEditorArea();
// Left
IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.20f, editorArea); //$NON-NLS-1$
left.addView(IPageLayout.ID_PROJECT_EXPLORER);
left.addPlaceholder(APP_EXPLORER_ID);
left.addPlaceholder("com.aptana.ui.io.remoteview"); //$NON-NLS-1$
// Bottom right: Console. Had to leave this programmatic to get the Console appear in bottom right
IFolderLayout bottomArea = layout.createFolder("terminalArea", IPageLayout.BOTTOM, 0.75f, //$NON-NLS-1$
editorArea);
bottomArea.addView(IConsoleConstants.ID_CONSOLE_VIEW);
bottomArea.addPlaceholder("com.aptana.terminal.views.terminal:*"); //$NON-NLS-1$
UIUtils.setCoolBarVisibility(true);
}
/**
* @param layout
* @param editorArea
*/
public void defineLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, (float) 0.26, editorArea); //$NON-NLS-1$
topLeft.addView("org.python.pydev.navigator.view");
IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
//outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
//Add the outline only if we're not using the minimap.
if (!MinimapOverviewRulerPreferencesPage.getShowMinimapContents()) {
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);
}
}
/**
* @param layout
*/
public void defineActions(IPageLayout layout) {
layout.addNewWizardShortcut(PythonProjectWizard.WIZARD_ID);
layout.addNewWizardShortcut(PythonSourceFolderWizard.WIZARD_ID);
layout.addNewWizardShortcut(PythonPackageWizard.WIZARD_ID);
layout.addNewWizardShortcut(PythonModuleWizard.WIZARD_ID);
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
layout.addShowViewShortcut("org.python.pydev.navigator.view");
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
layout.addShowViewShortcut("org.python.pydev.debug.pyunit.pyUnitView");
layout.addShowViewShortcut("org.python.pydev.debug.profile.ProfileView");
layout.addShowViewShortcut("org.python.pydev.views.PyCodeCoverageView");
layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
//layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);-- Navigator no longer supported
layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
}
/**
* @param page the page where the console view is
* @param restore whether we should try to restore it
* @return a list with the parts containing the console
*/
private static List<IViewPart> getConsoleParts(IWorkbenchPage page, boolean restore) {
List<IViewPart> consoleParts = new ArrayList<IViewPart>();
IViewReference[] viewReferences = page.getViewReferences();
for (IViewReference ref : viewReferences) {
if (ref.getId().equals(IConsoleConstants.ID_CONSOLE_VIEW)) {
IViewPart part = ref.getView(restore);
if (part != null) {
consoleParts.add(part);
if (restore) {
return consoleParts;
}
}
}
}
return consoleParts;
}
protected void addViewStructure(IPageLayout layout) {
String editorArea = layout.getEditorArea();
IFolderLayout leftFolder = layout.createFolder("leftPane", IPageLayout.LEFT, 0.25f, editorArea);
leftFolder.addView(IPageLayout.ID_PROJECT_EXPLORER);
IFolderLayout bottomFolder = layout.createFolder("bottomPane", IPageLayout.BOTTOM, 0.75f, editorArea);
bottomFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
bottomFolder.addView(IPageLayout.ID_TASK_LIST);
bottomFolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
bottomFolder.addView(IPageLayout.ID_PROGRESS_VIEW);
bottomFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
// Create outline after bottom pane
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.75f, editorArea);
}
@Override
public void init(IPageBookViewPage page, IConsole console) {
if (console instanceof SocketConsole) {
ShowOnContentChangeAction contentChange = new ShowOnContentChangeAction((SocketConsole)console);
// Contribute to the toolbar
IActionBars actionBars = page.getSite().getActionBars();
IToolBarManager mgr = actionBars.getToolBarManager();
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, contentChange);
}
}
/**
* Reveal the given console. If necessary, this will open the console view, bring it to the front, and reveal the
* given console inside the console view.
*/
public static void revealConsole(IConsole console) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
final IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
} catch (PartInitException e) {
// ignore
}
}
});
}
@Override
public void init(IPageBookViewPage page, IConsole console) {
closeAction = new CloseConsoleAction(console);
IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
@Override
public void init ( final IPageBookViewPage page, final IConsole console )
{
final ItemTraceIOConsole traceConsole = (ItemTraceIOConsole)console;
this.mgr = page.getSite ().getActionBars ().getToolBarManager ();
this.mgr.appendToGroup ( IConsoleConstants.OUTPUT_GROUP, new StopAction ( traceConsole ) );
this.mgr.appendToGroup ( IConsoleConstants.OUTPUT_GROUP, new CloseAction ( traceConsole ) );
}
protected void configureToolBar(IToolBarManager mgr) {
super.configureToolBar(mgr);
mgr.remove(IConsoleConstants.LAUNCH_GROUP);
IContributionItem[] items = mgr.getItems();
if (items.length >= 3) {
mgr.remove(items[items.length - 1]);
mgr.remove(items[items.length - 2]);
mgr.remove(items[items.length - 3]);
}
}
@After
@Before
public void stopLaunchesAndCloseConsoles() throws DebugException {
for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
launch.terminate();
}
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.removeConsoles(consoleManager.getConsoles());
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
for (IViewReference view : activePage.getViewReferences()) {
if (IConsoleConstants.ID_CONSOLE_VIEW.equals(view.getId())) {
activePage.hideView(view);
}
}
}
private void configureToolBar(IToolBarManager toolbarManager) {
terminateAction = createTerminateAction();
toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
closeAction = createCloseAction();
toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
@Override
public void init(IPageBookViewPage page, IConsole console) {
fCloseAction = new CloseConsoleAction(console);
IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);
}
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
//Navigator view left
layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.25f, editorArea);
//Outline view on the left
IFolderLayout left = layout.createFolder("left", IPageLayout.BOTTOM, 0.50f,
IPageLayout.ID_PROJECT_EXPLORER);
left.addView(IPageLayout.ID_OUTLINE);
left.addView(ID_FULL_OUTLINE);
IFolderLayout bottom =
layout.createFolder(
"bottom",
IPageLayout.BOTTOM,
0.70f,
editorArea);
bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
bottom.addView(IPageLayout.ID_TASK_LIST);
bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
bottom.addView(ID_TABLE_VIEW);
layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(ID_FULL_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
layout.addShowViewShortcut(ID_TABLE_VIEW);
//Add project and Latex file creation wizards to menu
layout.addNewWizardShortcut(ID_PROJECT_WIZARD);
layout.addNewWizardShortcut(ID_LATEX_FILE_WIZARD);
}
public XdsConsolePage(TextConsole console, IConsoleView view) {
super(console, view);
fPropertyChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
String property = event.getProperty();
if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
setReadOnly();
}
}
};
console.addPropertyChangeListener(fPropertyChangeListener);
}
public void openConsole()
{
IWorkbenchPage activePage = UIHelper.getActivePage();
if (activePage != null)
{
try
{
activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW, TLC_ID, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e)
{
ConsolePlugin.log(e);
}
}
}
/**
* Opens a generic console view using {@link TLAPMConsoleFactory#TLAPM_CONSOLE_ID} as the
* console name so that it can be found later.
*/
public void openConsole()
{
IWorkbenchPage activePage = UIHelper.getActivePage();
if (activePage != null)
{
try
{
activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW, TLAPM_CONSOLE_ID, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e)
{
ConsolePlugin.log(e);
}
}
}
public void init(IPageBookViewPage myPage, IConsole console) {
page = myPage;
IToolBarManager toolBarManager = page.getSite().getActionBars()
.getToolBarManager();
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator());
toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action(
LogViewerPlugin.getResourceString("logviewer.action.openwith.name"),
UIImages.getImageDescriptor(ILogViewerConstants.IMG_LOG_VIEWER)) {
public void run() {
ConsolePageParticipant.this.run();
}
});
}
/**
* Sets the terminate action which affects the visibility of the terminate
* button.
*
* @param terminateAction the action to invoke when the terminate button is
* clicked, or null to remove the terminate button
*/
public synchronized void setTerminateAction(TerminateAction terminateAction) {
TerminateAction oldTerminateAction = this.terminateAction;
this.terminateAction = terminateAction;
updateToolbarAction(oldTerminateAction, terminateAction,
IConsoleConstants.LAUNCH_GROUP);
}
private void createVerticalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.LEFT;
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.BOTTOM;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.BOTTOM;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.BOTTOM, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
private void createHorizontalLayout(IPageLayout layout) {
String relativePartId= IPageLayout.ID_EDITOR_AREA;
int relativePos= IPageLayout.TOP;
if (shouldShowProjectsView()) {
layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.TOP, (float)0.25, IPageLayout.ID_EDITOR_AREA);
relativePartId= JavaUI.ID_PROJECTS_VIEW;
relativePos= IPageLayout.RIGHT;
}
if (shouldShowPackagesView()) {
layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
relativePartId= JavaUI.ID_PACKAGES_VIEW;
relativePos= IPageLayout.RIGHT;
}
layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.RIGHT, (float)0.50, JavaUI.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);
IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
private void addViewShortcuts() {
factory.addShowViewShortcut("org.eclipse.ant.ui.views.AntView"); //NON-NLS-1
factory.addShowViewShortcut("org.eclipse.team.ccvs.ui.AnnotateView"); //NON-NLS-1
factory.addShowViewShortcut("org.eclipse.pde.ui.DependenciesView"); //NON-NLS-1
factory.addShowViewShortcut("org.eclipse.jdt.junit.ResultView"); //NON-NLS-1
factory.addShowViewShortcut("org.eclipse.team.ui.GenericHistoryView"); //NON-NLS-1
factory.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
factory.addShowViewShortcut(JavaUI.ID_PACKAGES);
factory.addShowViewShortcut(IPageLayout.ID_RES_NAV);
factory.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
factory.addShowViewShortcut(IPageLayout.ID_OUTLINE);
}
@Override
protected void configureToolBar(IToolBarManager mgr) {
super.configureToolBar(mgr);
fStdOut = new ShowStandardOutAction();
fStdErr = new ShowStandardErrorAction();
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
}
/**
* (non-Javadoc)
*
* @see IStreamingTextWidget#display()
*/
@Override
public void display() {
// Must sync with the display thread
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
// Get the currently active page
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
// Load the console view
consoleView = (IConsoleView) page
.showView(IConsoleConstants.ID_CONSOLE_VIEW);
// Create the console instance that will be used to display
// text from this widget.
console = new MessageConsole("CLI", null);
// Add the console to the console manager
ConsolePlugin.getDefault().getConsoleManager()
.addConsoles(new IConsole[] { console });
// Show the console in the view
consoleView.display(console);
console.activate();
// Get an output stream for the console
msgStream = console.newMessageStream();
msgStream.setActivateOnWrite(true);
msgStream.println("Streaming output console activated.");
} catch (PartInitException e) {
// Complain
logger.error("EclipseStreamingTextWidget Message: "
+ "Unable to stream text!");
logger.error(getClass().getName() + " Exception!", e);
}
}
});
return;
}
@Override
public void createInitialLayout(IPageLayout layout) {
// Setup the perspective shortcut button in the top right corner
layout.addPerspectiveShortcut(Perspective.ID);
// Reserve space for the Console and Properties
IFolderLayout bottomRight = layout.createFolder("bottomRight",
IPageLayout.BOTTOM, 0.70f, layout.getEditorArea());
bottomRight.addView(IConsoleConstants.ID_CONSOLE_VIEW);
bottomRight.addView(IPageLayout.ID_PROP_SHEET);
return;
}