本文整理汇总了Java中org.eclipse.ui.console.IConsoleView类的典型用法代码示例。如果您正苦于以下问题:Java IConsoleView类的具体用法?Java IConsoleView怎么用?Java IConsoleView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IConsoleView类属于org.eclipse.ui.console包,在下文中一共展示了IConsoleView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsole
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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;
}
示例2: show
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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);
}
示例3: getFlusher
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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;
}
示例4: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* 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;
}
示例5: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* @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;
}
示例6: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* @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;
}
示例7: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* @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;
}
示例8: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* @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;
}
示例9: consoleDispatch
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* @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;
}
示例10: iterConsoles
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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;
}
示例11: openDefaultConsole
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* 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();
}
}
示例12: showConsole
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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);
}
示例13: showConsole
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
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);
}
示例14: displayConsole
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* 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;
}
示例15: reset
import org.eclipse.ui.console.IConsoleView; //导入依赖的package包/类
/**
* 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);
}
});
}