19 package com.generalrobotix.ui.view;
21 import java.util.ArrayList;
22 import java.util.Vector;
24 import org.eclipse.jface.action.Action;
25 import org.eclipse.jface.action.IMenuListener;
26 import org.eclipse.jface.action.IMenuManager;
27 import org.eclipse.jface.action.MenuManager;
28 import org.eclipse.swt.SWT;
29 import org.eclipse.swt.custom.LineStyleEvent;
30 import org.eclipse.swt.custom.LineStyleListener;
31 import org.eclipse.swt.custom.StyleRange;
32 import org.eclipse.swt.custom.StyledText;
33 import org.eclipse.swt.events.DisposeListener;
34 import org.eclipse.swt.events.DisposeEvent;
35 import org.eclipse.swt.graphics.Color;
36 import org.eclipse.swt.widgets.Composite;
47 @SuppressWarnings(
"serial")
49 implements DisposeListener {
50 public static final String TITLE =
"Process Manager";
51 private StyledText outputArea_ =
null;
56 super(name, manager, vp, parent);
58 initializeComposite();
59 composite_.addDisposeListener(
this);
61 if(processManager_!=
null){
62 outputArea_.setText(
"");
63 String[] processed = processManager_.
getOutputBuffer().toString().split(
"\n", -1);
64 for (
int i = 0;
i < processed.length;
i++) {
65 if(processed[
i].startsWith(
"[")){
66 String
id=processed[
i].substring(1, processed[
i].indexOf(
":"));
69 outputArea_.append(processed[
i] +
"\n");
74 isScrollable_ =
false;
76 if(processManager_!=
null)
82 return new String[] {
"Tools" };
86 outputArea_ =
new StyledText(composite_, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
87 outputArea_.setEditable(
false);
91 MenuManager
manager =
new MenuManager();
92 manager.setRemoveAllWhenShown(
true);
93 manager.addMenuListener(
new IMenuListener() {
94 public void menuAboutToShow(IMenuManager menu) {
95 for (Action action : getOutputMenu()) {
100 outputArea_.setMenu(manager.createContextMenu(outputArea_));
104 Vector<Action> vector =
new Vector<Action>(
size());
105 for (
int i = 0;
i < processManager_.
size();
i++) {
107 Action action =
new Action(p.
pi_.
id, Action.AS_CHECK_BOX) {
110 String[] processed = processManager_.
getOutputBuffer().toString().split(
"\n");
111 outputArea_.setText(
"");
112 for (
int i = 0;
i < processed.length;
i++) {
113 for (
int j = 0; j < processManager_.
size(); j++) {
116 outputArea_.append(processed[
i] +
"\n");
127 Action actionClearAll =
new Action(
MessageBundle.
get(
"GrxProcessManager.menu.clearAll1"), Action.AS_PUSH_BUTTON) {
129 outputArea_.setText(
"");
133 vector.add(actionClearAll);
139 if(processManager_!=plugin)
return;
140 if((String)
arg[0]==
"append"){
141 outputArea_.append((String)
arg[1]);
142 }
else if((String)
arg[0]==
"setTopIndex"){
143 outputArea_.setTopIndex(outputArea_.getLineCount());
148 if(processManager_!=
null)
158 String
string =
event.lineText;
159 StyleRange[] styles =
new StyleRange[1];
160 styles[0] =
new StyleRange();
161 if(
string.startsWith(
"[")){
162 int i=
string.indexOf(
']');
164 char c =
string.charAt(i-1);
166 styles[0].start =
event.lineOffset;
167 styles[0].length =
string.length();
172 event.styles = styles;
void update(GrxBasePlugin plugin, Object... arg)
static final String get(String key)
StringBuffer getOutputBuffer()
void addObserver(GrxObserver v)
#define null
our own NULL pointer
png_infop png_charpp name
void deleteObserver(GrxObserver v)
void setShowOutput(boolean b)
void lineGetStyle(LineStyleEvent event)
static Activator getDefault()
GrxProcessManagerView(String name, GrxPluginManager manager, GrxBaseViewPart vp, Composite parent)
GrxBaseItem getItem(Class<? extends GrxBaseItem > cls, String name)
void setOutputBuffer(StringBuffer sb)
void initializeComposite()
void widgetDisposed(DisposeEvent e)
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
AProcess get(String name)
Vector< Action > getOutputMenu()