use of org.eclipse.swt.custom.ScrolledComposite in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method createPartControl.
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, false));
createToolBar(parent);
scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
scrolledComp.setLayout(new FillLayout());
scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
scrolledComp.getVerticalBar().setIncrement(10);
scrolledComp.addListener(SWT.Activate, new Listener() {
@Override
public void handleEvent(Event event) {
scrolledComp.setFocus();
}
});
chartAreaRootComp = new Composite(scrolledComp, SWT.NONE);
{
final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
chartAreaRootComp.setLayoutData(gd);
GridLayout layout = new GridLayout(3, false);
chartAreaRootComp.setLayout(layout);
chartAreaRootComp.setBackground(COLOR_CHART_AREA_BACKGROUND);
}
statisticDataMap = refreshData(statisticItemList);
createDataChart(chartAreaRootComp);
createAddChart(chartAreaRootComp);
createHiddenItems();
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setContent(chartAreaRootComp);
scrolledComp.setMinWidth(CHART_AREA_WIDTH);
updateScrolledCompositeHeight();
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.text by eclipse.
the class EncodingChangeTests method testChangeEncodingViaFile.
@Test
public void testChangeEncodingViaFile() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
fFile.setCharset(NON_DEFAULT_ENCODING, null);
} catch (CoreException ex) {
fail();
}
try {
fEditor = IDE.openEditor(page, fFile);
if (fEditor instanceof TextEditor) {
TextEditor editor = (TextEditor) fEditor;
Accessor accessor = new Accessor(editor, StatusTextEditor.class);
while (editor.getSite().getShell().getDisplay().readAndDispatch()) {
}
ScrolledComposite composite = (ScrolledComposite) accessor.get("fStatusControl");
assertNull(composite);
DefaultEncodingSupport encodingSupport = (DefaultEncodingSupport) editor.getAdapter(IEncodingSupport.class);
assertEquals(NON_DEFAULT_ENCODING, encodingSupport.getEncoding());
} else
fail();
} catch (PartInitException e) {
fail();
}
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.text by eclipse.
the class EncodingChangeTests method testChangeEncodingViaEncodingSupport.
@Test
public void testChangeEncodingViaEncodingSupport() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
fEditor = IDE.openEditor(page, fFile);
if (fEditor instanceof TextEditor) {
TextEditor editor = (TextEditor) fEditor;
while (editor.getSite().getShell().getDisplay().readAndDispatch()) {
}
DefaultEncodingSupport encodingSupport = (DefaultEncodingSupport) editor.getAdapter(IEncodingSupport.class);
encodingSupport.setEncoding(NON_DEFAULT_ENCODING);
Accessor accessor = new Accessor(editor, StatusTextEditor.class);
while (editor.getSite().getShell().getDisplay().readAndDispatch()) {
}
ScrolledComposite composite = (ScrolledComposite) accessor.get("fStatusControl");
assertNull(composite);
String actual = null;
try {
actual = fFile.getCharset(false);
} catch (CoreException e1) {
fail();
}
assertEquals(NON_DEFAULT_ENCODING, actual);
} else
fail();
} catch (PartInitException e) {
fail();
}
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.text by eclipse.
the class EncodingChangeTests method testAInvalidEncoding.
@Test
public void testAInvalidEncoding() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
fFile.setCharset("nonexistent", null);
} catch (CoreException e2) {
fail();
}
try {
fEditor = IDE.openEditor(page, fFile);
if (fEditor instanceof TextEditor) {
TextEditor editor = (TextEditor) fEditor;
Accessor accessor = new Accessor(editor, StatusTextEditor.class);
while (editor.getSite().getShell().getDisplay().readAndDispatch()) {
}
ITextFileBuffer fileBuffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(fFile.getFullPath(), LocationKind.IFILE);
DefaultEncodingSupport encodingSupport = (DefaultEncodingSupport) editor.getAdapter(IEncodingSupport.class);
String expected = encodingSupport.getStatusMessage(fileBuffer.getStatus());
Composite composite = (Composite) accessor.get("fStatusControl");
ScrolledComposite scrolledComposite = (ScrolledComposite) composite.getChildren()[0];
StyledText statusText = (StyledText) ((Composite) scrolledComposite.getContent()).getChildren()[5];
String actual = statusText.getText();
assertEquals(expected, actual);
} else
fail();
} catch (PartInitException e) {
fail();
}
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class AddBoxPage method createControl.
@Override
public void createControl(Composite parent) {
ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(container);
// Box name
final Label boxNameLabel = new Label(container, SWT.NONE);
boxNameLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImagePull.name.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxNameLabel);
final Text boxNameText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(boxNameText);
boxNameText.setToolTipText(// $NON-NLS-1$
WizardMessages.getString("ImagePull.name.tooltip"));
// Name binding
final IObservableValue<String> boxNameObservable = BeanProperties.value(AddBoxPageModel.class, AddBoxPageModel.BOX_NAME).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxNameText), boxNameObservable, new UpdateValueStrategy(), null);
// Box location
final Label boxLocLabel = new Label(container, SWT.NONE);
boxLocLabel.setText(// $NON-NLS-1$
WizardMessages.getString("ImagePull.loc.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxLocLabel);
final Text boxLocText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(boxLocText);
boxLocText.setToolTipText(// $NON-NLS-1$
WizardMessages.getString("ImagePull.loc.tooltip"));
// Location binding
final IObservableValue<String> imageNameObservable = BeanProperties.value(AddBoxPageModel.class, AddBoxPageModel.BOX_LOC).observe(model);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxLocText), imageNameObservable, new UpdateValueStrategy(), null);
// search
final Button searchButton = new Button(container, SWT.NONE);
searchButton.setText(// $NON-NLS-1$
WizardMessages.getString("ImagePull.search.label"));
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(searchButton);
searchButton.addSelectionListener(onSearchImage());
dbc.addValidationStatusProvider(new CreateBoxValidationStatusProvider(boxNameObservable, imageNameObservable));
// setup validation support
WizardPageSupport.create(this, dbc);
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(container);
}
Aggregations