package com.samsung.tizen.common.console;
import java.io.IOException;
+import java.lang.reflect.Method;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.SWT;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
-
+/**
+ * ConsoleManager.
+ * @author YoonKi Park {@literal <yoonki.park@samsung.com>} (S-Core)
+ * @author GyeongSeok Seo {@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ */
public class ConsoleManager
{
private IConsoleManager consoleManager;
this.console = getMessageConsole();
}
+ /**
+ * Change Console Name.
+ *
+ * @param newName - console Title. It shown console's tab bar.
+ * @author Gyeongseok.seo@samsung.com
+ */
+ public void changeConsolName(String newName) throws NoSuchFieldException, IllegalAccessException {
+ this.consoleName = newName;
+ Runnable runnable = new Runnable() {
+ public void run() {
+ Class<?> cls;
+ Method method;
+ try {
+ cls = Class.forName("org.eclipse.ui.console.AbstractConsole");
+ method = cls.getDeclaredMethod("setName", String.class);
+ method.setAccessible(true);
+ method.invoke(getConsole(), consoleName);
+ } catch (Exception e) {
+ ConsolePlugin.log(e);
+ }
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+ }
+
private MessageConsole getMessageConsole(){
boolean found = false;