rem: if (fEditor.Lock()) { size_t viewSize = fEditor.ViewSize();  if (viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize());  const char *buffer; if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK) fTextView->SetText(buffer);   fEditor.SetViewSize(viewSize);  fEditor.Unlock(); }
context: StringEditor::StringEditor(BRect rect, DataEditor &editor)	: BView(rect, "String Editor", B_FOLLOW_ALL, 0),	fEditor(editor){	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));	BStringView *stringView = new BStringView(BRect(5, 5, rect.right, 20),										B_EMPTY_STRING, "Contents:");	stringView->ResizeToPreferred();	AddChild(stringView);	rect = Bounds();	rect.top = stringView->Frame().bottom + 5;	rect.right -= B_V_SCROLL_BAR_WIDTH;	rect.bottom -= B_H_SCROLL_BAR_HEIGHT;	fTextView = new BTextView(rect, B_EMPTY_STRING, rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5),						B_FOLLOW_ALL, B_WILL_DRAW);	if (fEditor.Lock()) {		size_t viewSize = fEditor.ViewSize();		// that may need some more memory...		if (viewSize < fEditor.FileSize())			fEditor.SetViewSize(fEditor.FileSize());		const char *buffer;		if (fEditor.GetViewBuffer((const uint8 **)&buffer) == B_OK)			fTextView->SetText(buffer);		// restore old view size		fEditor.SetViewSize(viewSize);		fEditor.Unlock();	}#if 0	char *data = (char *)malloc(info.size);	if (data != NULL) {		if (fNode.ReadAttr(attribute, info.type, 0LL, data, info.size) >= B_OK)			fTextView->SetText(data);		free(data);	}#endif	BScrollView *scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, true, true);	AddChild(scrollView);}