Java 类org.eclipse.ui.console.IConsoleView 实例源码
项目:LogViewer
文件:ResourceUtils.java
public static IConsole getConsole(IWorkbenchPart part) {
if(!(part instanceof IViewPart)){
return null;
}
IViewPart vp =(IViewPart) part;
if (vp instanceof PageBookView) {
IPage page = ((PageBookView) vp).getCurrentPage();
ITextViewer viewer = getViewer(page);
if (viewer == null || viewer.getDocument() == null)
return null;
}
IConsole con = null;
try {
con = ((IConsoleView)part).getConsole();
} catch (Exception e) {
}
return con;
}
项目:cppcheclipse
文件:Console.java
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);
}
项目:brainfuck
文件:FlushConsoleHandler.java
private ConsoleStreamFlusher getFlusher(Object context) {
if (context instanceof IEvaluationContext) {
IEvaluationContext evaluationContext = (IEvaluationContext) context;
Object o = evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
if (!(o instanceof IWorkbenchPart)) {
return null;
}
IWorkbenchPart part = (IWorkbenchPart) o;
if (part instanceof IConsoleView && ((IConsoleView) part).getConsole() instanceof IConsole) {
IConsole activeConsole = (IConsole) ((IConsoleView) part).getConsole();
IProcess process = activeConsole.getProcess();
return (ConsoleStreamFlusher) process.getAdapter(ConsoleStreamFlusher.class);
}
}
return null;
}
项目:e4macs
文件:MarkExchangeHandler.java
/**
* Support exchange for simple mark on TextConsole
*
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, org.eclipse.ui.console.IConsoleView, org.eclipse.core.commands.ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
int mark = viewer.getMark();
StyledText st = viewer.getTextWidget();
if (mark != -1) {
try {
st.setRedraw(false);
int offset = st.getCaretOffset();
viewer.setMark(offset);
st.setCaretOffset(mark);
int len = offset - mark;
viewer.setSelectedRange(offset, -len);
} finally {
st.setRedraw(true);
}
}
return null;
}
项目:e4macs
文件:BackwardUpListHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.SexpBaseBackwardHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(final TextConsoleViewer viewer, final IConsoleView activePart, ExecutionEvent event) {
IDocument doc = viewer.getDocument();
boolean isBackup = getUniversalCount() > 0; // normal direction
ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
try {
int offset = doTransform(doc, selection, viewer.getTextWidget().getCaretOffset(),isBackup);
if (offset == NO_OFFSET) {
unbalanced(activePart,false);
} else {
endTransform(viewer, offset, selection, new TextSelection(null,offset,offset - selection.getOffset()));
}
} catch (BadLocationException e) {}
return null;
}
项目:e4macs
文件:SexpBaseBackwardHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
IDocument document = viewer.getDocument();
ITextSelection currentSelection = (ITextSelection)viewer.getSelectionProvider().getSelection();
ITextSelection selection = null;
try {
selection = getNextSexp(document, currentSelection);
if (selection == null) {
selection = currentSelection;
unbalanced(activePart,true);
return null;
} else {
return endTransform(viewer, selection.getOffset(), currentSelection, selection);
}
} catch (BadLocationException e) {
}
return null;
}
项目:e4macs
文件:EmacsMovementHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
StyledText st = viewer.getTextWidget();
String id = event.getCommand().getId();
boolean isSelect = isMarkEnabled(viewer,(ITextSelection)viewer.getSelection());
int action = getDispatchId(id,isSelect);
if (action > -1) {
st.invokeAction(action);
} else if ((id = getId(isSelect)) != null) {
// support sexps
try {
EmacsPlusUtils.executeCommand(id, null, activePart);
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
项目:e4macs
文件:SexpBaseForwardHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, org.eclipse.ui.console.IConsoleView, org.eclipse.core.commands.ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
IDocument document = viewer.getDocument();
ITextSelection currentSelection = (ITextSelection)viewer.getSelectionProvider().getSelection();
ITextSelection selection = new TextSelection(document, viewer.getTextWidget().getCaretOffset(), 0);
try {
selection = getNextSexp(document, selection);
if (selection == null) {
selection = currentSelection;
unbalanced(activePart,true);
return null;
} else {
return endTransform(viewer, selection.getOffset() + selection.getLength(), currentSelection, selection);
}
} catch (BadLocationException e) {
}
return null;
}
项目:e4macs
文件:ConsoleCmdHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
IDocument doc = viewer.getDocument();
int action = -1;
try {
StyledText st = viewer.getTextWidget();
action = getDispatchId(getId(event, viewer));
if (action > -1) {
// set up for kill ring
doc.addDocumentListener(KillRing.getInstance());
// setUpUndo(viewer);
st.invokeAction(action);
}
} finally {
// remove kill ring behavior
if (action > -1) {
doc.removeDocumentListener(KillRing.getInstance());
}
KillRing.getInstance().setKill(null, false);
}
return null;
}
项目:Pydev
文件:ScriptConsole.java
public static Iterable<IConsoleView> iterConsoles() {
List<IConsoleView> consoles = new ArrayList<>();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
List<IViewPart> consoleParts = getConsoleParts(page, false);
if (consoleParts.size() == 0) {
consoleParts = getConsoleParts(page, true);
}
for (IViewPart iViewPart : consoleParts) {
if (iViewPart instanceof IConsoleView) {
consoles.add((IConsoleView) iViewPart);
}
}
}
}
return consoles;
}
项目:turnus
文件:EclipseUtils.java
/**
* Open the default console
*/
public static void openDefaultConsole() {
try {
// open a new console in the active workbench window
MessageConsole console = getDefaultConsole();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
} catch (PartInitException e) {
e.printStackTrace();
}
}
项目:caml2tosca
文件:C2TRunHandler.java
private void showConsole(ExecutionEvent event) throws PartInitException, ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
String id = IConsoleConstants.ID_CONSOLE_VIEW;
IConsoleView view = (IConsoleView) page.showView(id);
view.display(this.console);
}
项目:dockerfoundry
文件:ViewHelper.java
public static void showConsole(String consoleName, String content) throws IOException, PartInitException{
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
MessageConsole console = ConsoleHelper
.findConsole(consoleName);
MessageConsoleStream out = console.newMessageStream();
out.println(content);
out.setActivateOnWrite(true);
out.setColor(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
out.close();
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
}
项目:EASyProducer
文件:EclipseConsole.java
/**
* Tries to show the console inside the GUI.
* @return <tt>true</tt> if the console could be displayed inside the GUI.
*/
public boolean displayConsole() {
boolean isDisplayed = false;
IWorkbenchPage activeWorkbenchPage = getActiveWorkbenchPage();
try {
IConsoleView consoleView = (IConsoleView) activeWorkbenchPage.showView(IConsoleConstants.ID_CONSOLE_VIEW);
consoleView.display(this.msgConsole);
isDisplayed = true;
} catch (PartInitException e) {
System.err.println("The console of the running Eclipse-instance could not be displayed: ");
e.printStackTrace();
}
return isDisplayed;
}
项目:asakusafw-shafu
文件:ShafuConsole.java
/**
* Rests this console.
* @since 0.5.3
*/
public void reset() {
clearConsole();
Activator.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
IConsoleView view = ui.get();
if (view == null || view.getConsole() != ShafuConsole.this) {
return;
}
view.setScrollLock(false);
}
});
}
项目:e4macs
文件:MarkSetHandler.java
/**
* Support simple mark on TextConsole
*
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
int offset = viewer.getTextWidget().getCaretOffset();
viewer.setSelectedRange(offset, 0);
viewer.setMark(offset);
return null;
}
项目:e4macs
文件:ConsoleCopyCutHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
@Override
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
Object result = null;
IDocument doc = viewer.getDocument();
try {
IWorkbenchPartSite site = activePart.getSite();
if (site != null) {
IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
if (doc != null && service != null) {
doc.addDocumentListener(KillRing.getInstance());
String cmdId = getId(event, viewer);
if (cmdId != null) {
result = service.executeCommand(cmdId, null);
}
}
}
} catch (CommandException e) {
// Shouldn't happen as the Command id will be null or valid
e.printStackTrace();
} finally {
if (doc != null) {
doc.removeDocumentListener(KillRing.getInstance());
}
// clear kill command flag
KillRing.getInstance().setKill(null, false);
}
MarkUtils.clearConsoleMark(viewer);
return result;
}
项目:e4macs
文件:KillLineHandler.java
/**
* When called from a console context, will use ST.CUT
*
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#consoleDispatch(TextConsoleViewer,
* IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
if (viewer.isEditable()) {
IDocument doc = viewer.getDocument();
StyledText st = viewer.getTextWidget();
int offset = st.getCaretOffset();
try {
IRegion info = doc.getLineInformationOfOffset(offset);
int noffset = info.getOffset() + info.getLength();
if (offset == noffset) {
int line = doc.getLineOfOffset(offset);
if (++line < doc.getNumberOfLines()) {
noffset = doc.getLineOffset(line);
if (noffset == doc.getLength()) {
noffset = offset;
}
}
}
if (offset != noffset) {
st.redraw();
st.setSelection(offset, noffset);
KillRing.getInstance().setKill(CUT_LINE_TO_END, false);
return super.consoleDispatch(viewer, activePart, event);
}
viewer.refresh();
} catch (BadLocationException e) {
}
}
return null;
}
项目:e4macs
文件:RecenterHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
RecenterState saveState = recenterState;
try {
StyledText st = viewer.getTextWidget();
st.redraw();
recenter(st);
} finally {
recenterState = saveState;
}
return null;
}
项目:e4macs
文件:BaseYankHandler.java
/**
* When called from a console context, use paste
*
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, org.eclipse.ui.console.IConsoleView, org.eclipse.core.commands.ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
StyledText st = viewer.getTextWidget();
try {
// set directly from the widget
widgetEol = st.getLineDelimiter();
paste(event,st,activePart.getConsole() instanceof IConsole);
} finally {
st.redraw();
widgetEol = null;
}
return null;
}
项目:e4macs
文件:DownListHandler.java
/**
* @see com.mulgasoft.emacsplus.commands.SexpBaseForwardHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(final TextConsoleViewer viewer, final IConsoleView activePart, ExecutionEvent event) {
IDocument doc = viewer.getDocument();
ITextSelection currentSelection = (ITextSelection) viewer.getSelectionProvider().getSelection();
ITextSelection selection = downList(doc, currentSelection);
if (selection == null) {
unbalanced(activePart,false);
} else {
endTransform(viewer,selection.getOffset() + selection.getLength(), currentSelection, selection);
}
return null;
}
项目:e4macs
文件:EmacsPlusConsole.java
/**
* @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
*/
public IPageBookViewPage createPage(IConsoleView view) {
IPageBookViewPage page = super.createPage(view);
if (page instanceof TextConsolePage) {
myPage = (TextConsolePage)page;
}
return page;
}
项目:Pydev
文件:PyOpenLastConsoleHyperlink.java
@Override
public void run(IAction action) {
for (IConsoleView c : ScriptConsole.iterConsoles()) {
IConsole console = c.getConsole();
if (console instanceof IOConsole) {
IOConsole ioConsole = (IOConsole) console;
processIOConsole(ioConsole);
break;
}
}
}
项目:Pydev
文件:ConsoleActivateDebugContext.java
@Override
public void init(IPageBookViewPage page, IConsole console) {
this.page = page;
this.console = (PydevConsole) console;
view = (IConsoleView) page.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
DebugUITools.getDebugContextManager().getContextService(page.getSite().getWorkbenchWindow())
.addDebugContextListener(this);
}
项目:jkind-xtext
文件:JKindMenuListener.java
private void showConsole(IConsole console) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
view.setScrollLock(true);
} catch (PartInitException e) {
}
}
项目:version-tiger
文件:ConsoleLogger.java
/**
* If the console view is hidden, it is put to the front and focus is set on
* it.
*/
private void putConsoleToForeground() throws PartInitException {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();// obtain the active page
String id = IConsoleConstants.ID_CONSOLE_VIEW;
IConsoleView view = (IConsoleView) page.showView(id);
view.display(console);
}
项目:goclipse
文件:ScrollLockAction.java
public ScrollLockAction(IConsoleView consoleView) {
super(ConsoleMessages.ScrollLockAction_Name);
fConsoleView = consoleView;
setToolTipText(ConsoleMessages.ScrollLockAction_Tooltip);
setImageDescriptor(LangImages.IMG_SCROLL_LOCK.getDescriptor());
boolean checked = fConsoleView.getScrollLock();
setChecked(checked);
}
项目:smaccm
文件:TestCaseGeneratorMenuListener.java
private void showConsole(IConsole console) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
view.setScrollLock(true);
} catch (PartInitException e) {
}
}
项目:smaccm
文件:TestSuiteMenuListener.java
private void showConsole(IConsole console) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
view.setScrollLock(true);
} catch (PartInitException e) {
}
}
项目:smaccm
文件:AssuranceCaseView.java
private void showConsole(IConsole console) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
view.setScrollLock(true);
} catch (PartInitException e) {
}
}
项目:smaccm
文件:AgreeMenuListener.java
private void showConsole(IConsole console) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
view.display(console);
view.setScrollLock(true);
} catch (PartInitException e) {
}
}
项目:dLabPro-Plugin
文件:AbstractConsoleViewActionDelegate.java
public void init(IViewPart view)
{
try
{
m_iView = view;
IConsoleView iCv = (IConsoleView)view;
iCv.addPropertyListener(this);
}
catch (Exception e)
{
DdUtils.EXCEPTION(e);
}
}
项目:eclox
文件:Console.java
/**
* @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
*/
public IPageBookViewPage createPage(IConsoleView view) {
return new ConsolePage(this);
}
项目:CppStyle
文件:CppStyleMessageConsole.java
@Override
public IPageBookViewPage createPage(IConsoleView view) {
page = new CppStyleConsolePage(this, view);
return page;
}
项目:CppStyle
文件:CppStyleConsolePage.java
public CppStyleConsolePage(CppStyleMessageConsole console, IConsoleView view) {
super(console, view);
this.console = console;
}
项目:asakusafw-shafu
文件:ShafuConsole.java
@Override
public IPageBookViewPage createPage(IConsoleView view) {
IPageBookViewPage result = super.createPage(view);
ui.set(view);
return result;
}
项目:e4macs
文件:EmacsPlusCmdHandler.java
/**
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@SuppressWarnings("unchecked")
public Object execute(ExecutionEvent event) throws ExecutionException {
ITextEditor editor = getTextEditor(event);
if (editor == null) {
if (isWindowCommand()) {
Object result = checkExecute(event);
if (result == Check.Fail) {
beep();
result = null;
}
return result;
} else if (isConsoleCommand()) {
// intercept and dispatch execution if console supported and used in a console view
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart != null && (activePart instanceof IConsoleView) && (activePart instanceof PageBookView)) {
IPage textPage = ((PageBookView)activePart).getCurrentPage();
if (textPage instanceof TextConsolePage) {
return ((IConsoleDispatch)this).consoleDispatch(((TextConsolePage)textPage).getViewer(),(IConsoleView)activePart,event);
}
}
}
}
try {
setThisEditor(editor);
isEditable = getEditable();
if (editor == null || isBlocked()) {
beep();
asyncShowMessage(editor, INEDITABLE_BUFFER, true);
return null;
}
// Retrieve the universal-argument parameter value if passed
if (extractUniversalCount(event) != 1) {
// check if we should dispatch a related command based on the universal argument
String dispatchId = checkDispatchId(event.getCommand().getId());
if (dispatchId != null) {
// recurse on new id (inverse or arg value driven)
return dispatchId(editor, dispatchId, getParams(event.getCommand(), event.getParameters()));
}
}
setThisDocument(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
// Get the current selection
ISelectionProvider selectionProvider = editor.getSelectionProvider();
ITextSelection selection = (ITextSelection) selectionProvider.getSelection();
preTransform(editor, selection);
return transformWithCount(editor, getThisDocument(), selection, event);
} finally {
// normal commands clean up here
if (isTransform()) {
postExecute();
}
}
}
项目:Pydev
文件:ScriptConsolePage.java
public ScriptConsolePage(ScriptConsole console, IConsoleView view, SourceViewerConfiguration cfg) {
super(console, view);
this.cfg = cfg;
}
项目:Pydev
文件:ScriptConsole.java
/**
* Creates the actual page to be shown to the user.
*/
@Override
public IPageBookViewPage createPage(IConsoleView view) {
page = new ScriptConsolePage(this, view, createSourceViewerConfiguration());
return page;
}
项目:goclipse
文件:ToolsConsole.java
@Override
public IPageBookViewPage createPage(IConsoleView view) {
return new ToolsConsolePage(this, view);
}