@Override public String getName(Object page) { return ((IConsole) page).getName(); }
public String getConsolePath(IConsole console) { return console.getClass().toString().replaceFirst("class ", "") + System.getProperty("file.separator") + console.getName(); }
/** * Constructs an action to display the given console. * * @param view the console view in which the given console is contained * @param console the console */ public ShowConsoleAction(IConsoleView view, IConsole console) { super(console.getName(), AS_RADIO_BUTTON); fConsole = console; fView = view; setImageDescriptor(console.getImageDescriptor()); } }
/** * Constructs an action to display the given console. * * @param view the console view in which the given console is contained * @param console the console */ public ShowConsoleAction(IConsoleView view, IConsole console) { super(console.getName(), AS_RADIO_BUTTON); fConsole = console; fView = view; setImageDescriptor(console.getImageDescriptor()); } }
/** * Updates the view title based on the active console */ protected void updateTitle() { IConsole console = getConsole(); if (console == null) { setContentDescription(ConsoleMessages.ConsoleView_0); } else { String newName = console.getName(); String oldName = getContentDescription(); if (newName!=null && !(newName.equals(oldName))) { setContentDescription(console.getName()); } } }
/** * Updates the view title based on the active console */ protected void updateTitle() { IConsole console = getConsole(); if (console == null) { setContentDescription(ConsoleMessages.ConsoleView_0); } else { String newName = console.getName(); String oldName = getContentDescription(); if (newName!=null && !(newName.equals(oldName))) { setContentDescription(console.getName()); } } }
private static MessageConsole findConsole(String name) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) if (name.equals(existing[i].getName())) return (MessageConsole) existing[i]; MessageConsole myConsole = new MessageConsole(name, null); conMan.addConsoles(new IConsole[] { myConsole }); return myConsole; }
private IConsole findConsole() throws FileNotFoundException { ConsolePlugin conPlugin = ConsolePlugin.getDefault(); IConsoleManager conMan = conPlugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); int nameFoundIndex = -1; for (int i = 0; i < existing.length; i++) { // check full name first if (getConsolePath(existing[i]).equals(getPath())) { return existing[i]; } // check short name if not already found int flags = 0; flags = java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.UNICODE_CASE; regexp = Pattern.compile(getNamePattern(), flags); if ((nameFoundIndex == -1) && regexp.matcher(existing[i].getName()).matches()) { nameFoundIndex = i; } } if (nameFoundIndex != -1) { return existing[nameFoundIndex]; } throw new FileNotFoundException("no console found"); }
/** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { if (!isEnabled()) { MessageDialog.openInformation( new Shell(), "Logfile Viewer", "Wrong Selection"); return; } for (int i=0;i<resource.length;i++) { if (resource[i] == null) continue; String full_path = resource[i].getClass().toString().replaceFirst("class ", "") + System.getProperty("file.separator") + resource[i].getName(); LogViewer view = null; try { view = (LogViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("de.anbos.eclipse.logviewer.plugin.LogViewer"); } catch (PartInitException e) { e.printStackTrace(); } view.checkAndOpenFile(LogFileType.LOGFILE_ECLIPSE_CONSOLE, full_path, null, false); } }
private MessageConsole findConsole() { if(console == null) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (commandID.equals(existing[i].getName())) { console = (MessageConsole) existing[i]; console.clearConsole(); return console; } } // no console found, so create a new one MessageConsole myConsole = new MessageConsole(commandID, null); conMan.addConsoles(new IConsole[] { myConsole }); console = myConsole; } return console; }
public static CppStyleMessageConsole buildConsole() { CppStyleMessageConsole console = null; ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) { if (CppStyleConstants.CONSOLE_NAME.equals(existing[i].getName())) { console = (CppStyleMessageConsole) existing[i]; } } if (console == null) { // no console found, so create a new one CppStyleConsolePatternMatchListener listener = new CppStyleConsolePatternMatchListener(); console = new CppStyleMessageConsole(listener); conMan.addConsoles(new IConsole[] { console }); } console.clear(); return console; } }
protected Control createDialogArea(Composite parent) { String fileTypeName = "File"; // create composite Composite composite = (Composite) super.createDialogArea(parent); // create combo typeCombo = new Combo(composite,SWT.LEFT); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); typeCombo.setLayoutData(data); // fill IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles(); typeCombo.add(fileTypeName); value = fileTypeName; for (int i=0;i<consoles.length;i++) { typeCombo.add("Console: " + consoles[i].getName()); } applyDialogFont(composite); return composite; }
public void clearCurrentLogFile() { try { LogFileType type = getSelectedTab().getDocument().getFile().getType(); if (type == LogFileType.LOGFILE_ECLIPSE_CONSOLE) { final IConsole con = getSelectedTab().getDocument().getReader().getConsoleTail().getConsole(); if (con instanceof TextConsole) { Display.getDefault().syncExec(new Runnable() { public void run() { ((TextConsole) con).clearConsole(); } }); } else { logger.logWarning("Console" + "[ " + con.getName() + " ]" + " clear not supported");//$NON-NLS-1$ } } else { FileTail file = getSelectedTab().getDocument().getReader().getFileTail(); Buffer buffer = file.getBuffer(); if (buffer != null) { file.stopFileMapping(buffer); } PrintWriter pw = new PrintWriter(getCurrentLogFilePath()); pw.write(" "); pw.close(); } } catch (Exception e) { logger.logError("unable to clear selected file: " + getCurrentLogFilePath()); //$NON-NLS-1$ } refreshCurrentLogFile(); }