下面列出了org.eclipse.jface.viewers.CheckboxCellEditor#org.eclipse.jface.layout.GridLayoutFactory 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Label lbName = new Label(composite, SWT.NONE);
lbName.setText("Name :");
txName = new Text(composite, SWT.BORDER);
Label lbFirstname = new Label(composite, SWT.NONE);
lbFirstname.setText("Firstname :");
txFirstname = new Text(composite, SWT.BORDER);
GridLayoutFactory.fillDefaults().generateLayout(composite);
// binding
Binding b = dbc.bindValue(SWTObservables.observeText(txFirstname, SWT.FocusOut), PojoObservables.observeValue(hero, "firstname"), null, null);
b = dbc.bindValue(SWTObservables.observeText(txName, SWT.FocusOut), PojoObservables.observeValue(hero, "name"), null, null);
return composite;
}
private void createUnstagedComposite(Composite parent) {
this.unstagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
this.unstagedSection.setText(Messages.AbapGitStaging_unstaged_changes_section_header + " (0)"); //$NON-NLS-1$
this.unstagedSection.clientVerticalSpacing = 0;
//unstaged section toolbar
this.createUnstagedSectionToolbar();
Composite unstagedComposite = this.toolkit.createComposite(this.unstagedSection);
this.toolkit.paintBordersFor(unstagedComposite);
GridLayoutFactory.fillDefaults().applyTo(unstagedComposite);
this.unstagedSection.setClient(unstagedComposite);
//create the treeviewer
this.unstagedTreeViewer = this.createTreeViewer(unstagedComposite, true);
this.unstagedTreeViewer.setInput(this.unstagedTreeViewerInput);
addDragAndDropSupport(this.unstagedTreeViewer, true);
//add context menu support to the tree viewer
this.unstagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.unstagedTreeViewer, true, this, this.stagingUtil);
}
private void createStagedComposite(Composite parent) {
this.stagedSection = this.toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
this.stagedSection.setText(Messages.AbapGitStaging_staged_changes_section_header + " (0)"); //$NON-NLS-1$
this.stagedSection.clientVerticalSpacing = 0;
//staged section toolbar
this.createStagedSectionToolbar();
Composite stagedComposite = this.toolkit.createComposite(this.stagedSection);
this.toolkit.paintBordersFor(stagedComposite);
GridLayoutFactory.fillDefaults().applyTo(stagedComposite);
this.stagedSection.setClient(stagedComposite);
//create the treeviewer
this.stagedTreeViewer = this.createTreeViewer(stagedComposite, false);
this.stagedTreeViewer.setInput(this.stagedTreeViewerInput);
addDragAndDropSupport(this.stagedTreeViewer, false);
//add context menu support to the tree viewer
this.stagedMenuFactory = new AbapGitStagingObjectMenuFactory(this.stagedTreeViewer, false, this, this.stagingUtil);
}
private void createCommitMessageComposite(Composite parent) {
Composite commitMessageComposite = this.toolkit.createComposite(parent);
this.toolkit.paintBordersFor(commitMessageComposite);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(commitMessageComposite);
GridDataFactory.fillDefaults().grab(true, true).applyTo(commitMessageComposite);
this.commitMessageTextViewer = new TextViewer(commitMessageComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
this.commitMessageTextViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(this.commitMessageTextViewer.getTextWidget());
this.commitMessageTextViewer.getTextWidget().setAlwaysShowScrollBars(false);
this.commitMessageTextViewer.getTextWidget().setFont(JFaceResources.getTextFont());
SWTUtil.addTextEditMenu(this.commitMessageTextViewer.getTextWidget());
//draw a line to hint the max commit line length
createMarginPainter(this.commitMessageTextViewer);
this.commitMessageTextViewer.getTextWidget().addModifyListener(e -> validateInputs());
}
/**
* Adds a filter text box in the view toolbar
*/
private ControlContribution createObjectsFilterText() {
//create filter text composite
ControlContribution filterTextboxContribution = new ControlContribution("AbapGitStagingView.filterText") { //$NON-NLS-1$
protected Control createControl(Composite parent) {
Composite filterComposite = AbapGitStagingView.this.toolkit.createComposite(parent, 0);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(filterComposite);
filterComposite.setBackground(null);
AbapGitStagingView.this.filterText = new Text(filterComposite, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);
AbapGitStagingView.this.filterText.setMessage(Messages.AbapGitStaging_object_filter_text);
GridData data = new GridData(SWT.LEFT, SWT.TOP, true, false);
data.minimumWidth = 150;
AbapGitStagingView.this.filterText.setLayoutData(data);
AbapGitStagingView.this.filterText.addModifyListener(e -> applyFilter());
return filterComposite;
}
};
return filterTextboxContribution;
}
private void createVendorIdControls(DataBindingContext dbc, Composite parent) {
final Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Label vendorIdLabel = new Label(composite, SWT.NONE);
vendorIdLabel.setText("Vendor id:");
Text vendorIdText = new Text(composite, SWT.BORDER);
vendorIdText.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());
projectInfo.addPropertyChangeListener(event -> {
if (event.getPropertyName().equals(N4JSProjectInfo.VENDOR_ID_PROP_NAME)) {
setPageComplete(validatePage());
}
});
dbc.bindValue(WidgetProperties.text(Modify).observe(vendorIdText),
BeanProperties.value(N4JSProjectInfo.class, N4JSProjectInfo.VENDOR_ID_PROP_NAME).observe(projectInfo));
}
private Composite initTestProjectUI(DataBindingContext dbc, Composite parent) {
// Additional test project options
final Group testProjectOptionsGroup = new Group(parent, NONE);
testProjectOptionsGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
final Button createTestGreeterFileButton = new Button(testProjectOptionsGroup, CHECK);
createTestGreeterFileButton.setText("Create a test project greeter file");
final Button addNormalSourceFolderButton = new Button(testProjectOptionsGroup, CHECK);
addNormalSourceFolderButton.setText("Also create a non-test source folder");
Label nextPageHint = new Label(testProjectOptionsGroup, NONE);
nextPageHint.setText("The projects which should be tested can be selected on the next page");
nextPageHint.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
initTestProjectBinding(dbc, addNormalSourceFolderButton, createTestGreeterFileButton);
return testProjectOptionsGroup;
}
@Override
public void createControl(Composite parent) {
paneComposite = new Composite(parent, SWT.NONE);
paneComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).create());
super.createControl(paneComposite);
workspaceWizardControl.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
createPreview(paneComposite);
createBottomControls(paneComposite);
setControl(paneComposite);
boolean hidePreviewSetting = getDialogSettings().getBoolean(DIALOG_SETTING_HIDE_PREVIEW_KEY);
if (hidePreviewSetting) {
hideContentPreview();
} else {
// Otherwise just make sure the shell size is set
getShell().setMinimumSize(PREVIEW_MINIMUM_SHELL_SIZE);
}
}
private void createNameArea(Composite parent, String areaName, Consumer<String> textHandler) {
final Group area = new Group(parent, SHADOW_ETCHED_IN);
area.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
area.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
area.setText(areaName);
final Text txtPackageName = getSimpleTextArea(area);
txtPackageName.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
Text textWidget = (Text) e.getSource();
textHandler.accept(textWidget.getText());
}
});
}
/**
* Builds the new column viewer instance.
*
* @param parent
* the parent composite for the viewer.
* @return the new new column viewer.
*/
public final CV build(final Composite parent) {
final Composite container = new Composite(parent, NONE);
container.setLayout(GridLayoutFactory.fillDefaults().create());
container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());
final Composite composite = new Composite(container, NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());
final AbstractColumnLayout layout = createColumnLayout();
composite.setLayout(layout);
final CV viewer = createViewer(composite, layout, NONE | V_SCROLL | H_SCROLL | getStyle());
viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(labelProvider);
viewer.setUseHashlookup(useHashlookup);
return viewer;
}
@Override
protected Control createContents(final Composite parent) {
Composite body = new Composite(parent, NONE);
body.setLayout(GridLayoutFactory.fillDefaults().create());
body.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(FILL, FILL).create());
final Iterable<Binary> binaries = binariesProvider.getRegisteredBinaries();
for (final Binary binary : binaries) {
final Group binaryGroup = new Group(body, SWT.SHADOW_ETCHED_IN);
binaryGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(true).create());
binaryGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(FILL, TOP).create());
recursiveAddBinaryGroup(binaryGroup, binary);
}
refreshErrorMessage();
return body;
}
@SuppressWarnings("unchecked")
@Override
public Control createSupportArea(final Composite parent, final StatusAdapter statusAdapter) {
final IStatus status = statusAdapter.getStatus();
if (status instanceof BinaryStatus) {
final Binary binary = ((BinaryStatus) status).getBinary();
final Composite control = new Composite(parent, SWT.NONE);
control.setLayout(GridLayoutFactory.swtDefaults().margins(10, 10).create());
control.setLayoutData(new GridData(FILL, FILL, true, true));
return createCustomAreaWithLink(control, manager.getDialog(), binary);
}
return new DefaultDetailsArea(manager.getDialogState()).createSupportArea(parent, statusAdapter);
}
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
setControl(container);
GridLayoutFactory.swtDefaults().numColumns(4).applyTo(container);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
projectInput = new InputComponent(container, Messages.LaunchUI_project, result -> {
setDirty(true);
setProject(projectInput.getValue());
updateLaunchConfigurationDialog();
});
projectInput.createComponent();
projectInput.createProjectSelection();
createExtraControlsGroup(container);
workingDirectoryInput = new OptionalDefaultInputComponent(container, Messages.LaunchUI_workingDirectory,
result -> {
setDirty(true);
updateLaunchConfigurationDialog();
}, () -> getDefaultWorkingDirectoryPath());
workingDirectoryInput.createComponent();
workingDirectoryInput.createContainerSelection(() -> project);
}
@Override
protected Control createDialogArea(final Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
Link flexPricing = new Link(container, SWT.WRAP);
flexPricing.setText(Messages.getString("deploy.preferences.dialog.flex.pricing")); //$NON-NLS-1$
flexPricing.addSelectionListener(
new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
FontUtil.convertFontToItalic(flexPricing);
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
Point margins = LayoutConstants.getMargins();
GridLayoutFactory.fillDefaults()
.extendedMargins(margins.x, margins.x, 0 /* no upper margin */, margins.y)
.generateLayout(container);
return area;
}
/**
* Helper method to create a row of a {@link Label}, a {@link Text} for a file path input, and
* a "browse" {@link Button} to open a {@link FileDialog}.
*
* @param fileFieldBasePath a base path that file input fields will treat as a prefix. The path is
* for 1) relativizing absolute paths in file input fields; and 2) setting the default path for
* the file chooser dialog.
*/
protected Text createBrowseFileRow(String labelText, String Tooltip,
IPath fileFieldBasePath, String[] fileDialogfilterExtensions) {
Label label = new Label(this, SWT.LEAD);
label.setText(labelText);
label.setToolTipText(Tooltip);
Composite secondColumn = new Composite(this, SWT.NONE);
Text fileField = new Text(secondColumn, SWT.SINGLE | SWT.BORDER);
fileField.setToolTipText(Tooltip);
Button browse = new Button(secondColumn, SWT.PUSH);
browse.setText(Messages.getString("deploy.preferences.dialog.browse"));
browse.addSelectionListener(
new RelativeFileFieldSetter(fileField, fileFieldBasePath, fileDialogfilterExtensions));
GridDataFactory.fillDefaults().applyTo(secondColumn);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fileField);
GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(secondColumn);
return fileField;
}
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
content = createDeployPreferencesPanel(container, project, loginService,
this::handleLayoutChange, new ProjectRepository(googleApiFactory));
GridDataFactory.fillDefaults().grab(true, false).applyTo(content);
// we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults()
.margins(LayoutConstants.getMargins().x, LayoutConstants.getMargins().y)
.generateLayout(container);
TitleAreaDialogSupport.create(this, content.getDataBindingContext())
.setValidationMessageProvider(new ValidationMessageProvider() {
@Override
public int getMessageType(ValidationStatusProvider statusProvider) {
int type = super.getMessageType(statusProvider);
setValid(type != IMessageProvider.ERROR);
return type;
}
});
return area;
}
private Composite createBucketSection(Composite parent) {
Composite bucketComposite = new Composite(parent, SWT.NONE);
Label bucketLabel = new Label(bucketComposite, SWT.LEAD);
bucketLabel.setText(Messages.getString("custom.bucket"));
bucketLabel.setToolTipText(Messages.getString("tooltip.staging.bucket"));
bucket = new Text(bucketComposite, SWT.LEAD | SWT.SINGLE | SWT.BORDER);
bucket.setMessage(Messages.getString("custom.bucket.hint"));
GridData bucketData = new GridData(SWT.FILL, SWT.CENTER, true, false);
bucket.setLayoutData(bucketData);
bucket.setToolTipText(Messages.getString("tooltip.staging.bucket"));
GridLayoutFactory.fillDefaults().numColumns(2).generateLayout(bucketComposite);
return bucketComposite;
}
public MavenCoordinatesUi(Composite container, int style) {
super(container, style);
groupIdLabel = new Label(this, SWT.LEAD);
groupIdLabel.setText(Messages.getString("GROUP_ID")); //$NON-NLS-1$
groupIdField = new Text(this, SWT.BORDER);
groupIdField.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$
artifactIdLabel = new Label(this, SWT.LEAD);
artifactIdLabel.setText(Messages.getString("ARTIFACT_ID")); //$NON-NLS-1$
artifactIdField = new Text(this, SWT.BORDER);
artifactIdField.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$
versionLabel = new Label(this, SWT.LEAD);
versionLabel.setText(Messages.getString("ARTIFACT_VERSION")); //$NON-NLS-1$
versionField = new Text(this, SWT.BORDER);
versionField.setText(DEFAULT_VERSION);
GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(this);
}
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Composite container = (Composite) getControl();
setHelp(container);
createCustomFields(container);
mavenCoordinatesUi = new MavenCoordinatesWizardUi(container, SWT.NONE);
mavenCoordinatesUi.addChangeListener(event -> revalidate());
mavenCoordinatesUi.addGroupIdModifyListener(new AutoPackageNameSetterOnGroupIdChange());
revalidate();
// Show enter project name on opening
setErrorMessage(null);
setMessage(Messages.getString("enter.project.name")); //$NON-NLS-1$
GridLayoutFactory.swtDefaults().generateLayout(container);
Dialog.applyDialogFont(container);
}
private void createButtons(Composite container) {
Composite buttonArea = new Composite(container, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(buttonArea);
Button addAccountButton = new Button(buttonArea, SWT.FLAT);
addAccountButton.setText(Messages.getString("BUTTON_ACCOUNTS_PANEL_ADD_ACCOUNT"));
addAccountButton.addSelectionListener(new LogInOnClick());
GridDataFactory.defaultsFor(addAccountButton).applyTo(addAccountButton);
if (loginService.hasAccounts()) {
Button logOutButton = new Button(buttonArea, SWT.FLAT);
logOutButton.setText(Messages.getString("BUTTON_ACCOUNTS_PANEL_LOGOUT"));
logOutButton.addSelectionListener(new LogOutOnClick());
GridDataFactory.defaultsFor(logOutButton).applyTo(logOutButton);
}
}
protected final void createWidget(Composite parent, boolean restrictedEnvironment) {
Preconditions.checkNotNull(libraryGroups, "Library groups must be set"); //$NON-NLS-1$
Composite composite = new Composite(parent, SWT.NONE);
// create the library selector libraryGroups
for (Entry<String, String> group : libraryGroups.entrySet()) {
LibrarySelectorGroup librariesSelector =
new LibrarySelectorGroup(
composite, group.getKey(), group.getValue(), restrictedEnvironment);
librariesSelectors.add(librariesSelector);
}
setSelectedLibraries(initialSelection);
GridLayoutFactory.fillDefaults().numColumns(libraryGroups.size()).generateLayout(composite);
setControl(composite);
}
public ProjectSelector(Composite parent) {
super(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this);
Composite tableComposite = new Composite(this, SWT.NONE);
TableColumnLayout tableColumnLayout = new TableColumnLayout();
tableComposite.setLayout(tableColumnLayout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
createColumns(tableColumnLayout);
viewer.getTable().setHeaderVisible(true);
viewer.getTable().setLinesVisible(false);
input = WritableList.withElementType(GcpProject.class);
projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$
ViewerSupport.bind(viewer, input, projectProperties);
viewer.setComparator(new ViewerComparator());
Composite linkComposite = new Composite(this, SWT.NONE);
statusLink = new Link(linkComposite, SWT.WRAP);
statusLink.addSelectionListener(
new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
statusLink.setText("");
GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite);
GridLayoutFactory.fillDefaults().generateLayout(linkComposite);
}
@Override
protected Control createContents(Composite parent) {
getShell().setText(Messages.ManageXMLAnalysisDialog_ManageXmlAnalysesFiles);
Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(new GridLayout(2, false));
Composite tableContainer = new Composite(mainComposite, SWT.NONE);
tableContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayoutFactory.fillDefaults().applyTo(tableContainer);
// Create sub-contents
createTable(tableContainer);
createLabels(tableContainer);
createImportButtons(mainComposite);
createSelectionButtons(mainComposite);
fillAnalysesTable();
getShell().setMinimumSize(300, 275);
return mainComposite;
}
@Override
protected Control createDialogArea(Composite parent)
{
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(GridLayoutFactory.swtDefaults().create());
main.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
if (clickListener != null)
{
main.addMouseListener(clickListener);
}
Label infoLabel = new Label(main, SWT.WRAP);
infoLabel.setText(message);
infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
if (clickListener != null)
{
infoLabel.addMouseListener(clickListener);
}
return main;
}
@Override
protected Control createButtonBar(Composite parent)
{
new Label(parent, SWT.None);
Composite buttonsComp = new Composite(parent, SWT.None);
// Intentionally make the numOfColmnns to 0 as they will be incremented in createButton methods.
buttonsComp.setLayout(GridLayoutFactory.fillDefaults().numColumns(0).equalWidth(true).create());
buttonsComp
.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).align(SWT.END, SWT.BEGINNING).create());
createButton(buttonsComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
Button okBtn = createButton(buttonsComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
okBtn.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).create());
return parent;
}
/**
* Do layout. Several magic #s in here...
*
* @param scrolledComposite
*/
private void setupScrolledComposite() {
setAlwaysShowScrollBars(true);
scrolledCanvas = new Composite(this, SWT.NONE);
GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(scrolledCanvas);
setMinWidth(100);
setMinHeight(100);
setExpandHorizontal(true);
setExpandVertical(true);
setMinHeight(1);
Point size = scrolledCanvas.computeSize(getParent().getSize().x,
SWT.DEFAULT, true);
scrolledCanvas.setSize(size);
addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
doUpdateContentSize();
updateScrollIncrements();
}
});
setContent(scrolledCanvas);
}
@Override
protected void createFieldEditors() {
Composite parent = new Composite(getFieldEditorParent(), SWT.NONE);
GridLayoutFactory.fillDefaults() //
.numColumns(2) //
.margins(5, 8) //
.spacing(5, 20) //
.applyTo(parent);
// Should wrap the fields in a composite to allow use of spacing.
{
Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
addField(new BooleanFieldEditor(ADVANCED_VALIDATION, "Enable advanced validation", composite));
}
Set<PreferenceProvider> providers = ExtensionUtils.getPreferenceProviders(VALIDATION_PREFERENCE_PAGE);
providers.forEach(provider -> {
for (FieldEditor field : provider.createFields(Version.OPENAPI, parent)) {
addField(field);
}
});
}
@Override
public void createControl(Composite parent) {
Composite comp = new Group(parent, SWT.NONE);
setControl(comp);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp);
Label labelProject = new Label(comp, SWT.NONE);
labelProject.setText(Messages.Launch_Project);
GridDataFactory.swtDefaults().applyTo(labelProject);
comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
for (IProject project : getProjectsInWorkspace()) {
comboProject.add(project.getName());
}
GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject);
comboProject.addModifyListener(event -> updateLaunchConfigurationDialog());
Label labelSdkLocation = new Label(comp, SWT.NONE);
labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart);
GridDataFactory.swtDefaults().applyTo(labelSdkLocation);
textSdkLocation = new Text(comp, SWT.BORDER);
textSdkLocation.setMessage(Messages.Launch_SDKLocation_Message);
GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation);
textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog());
Label labelMainClass = new Label(comp, SWT.NONE);
labelMainClass.setText(Messages.Launch_MainClass);
GridDataFactory.swtDefaults().applyTo(labelMainClass);
textMainClass = new Text(comp, SWT.BORDER);
textMainClass.setMessage(Messages.Launch_MainClass_Message);
GridDataFactory.fillDefaults().grab(true, false).applyTo(textMainClass);
textMainClass.addModifyListener(event -> updateLaunchConfigurationDialog());
}
@Override
public void createControl(Composite parent) {
Composite comp = new Group(parent, SWT.NONE);
setControl(comp);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp);
Label labelProject = new Label(comp, SWT.NONE);
labelProject.setText(Messages.Launch_Project);
GridDataFactory.swtDefaults().applyTo(labelProject);
comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN);
for (IProject project : getProjectsInWorkspace()) {
comboProject.add(project.getName());
}
GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject);
comboProject.addModifyListener(event -> updateLaunchConfigurationDialog());
Label labelSdkLocation = new Label(comp, SWT.NONE);
labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart);
GridDataFactory.swtDefaults().applyTo(labelSdkLocation);
textSdkLocation = new Text(comp, SWT.BORDER);
textSdkLocation.setMessage("SDK Location");
GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation);
textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog());
createPageSpecificControls(comp);
}
public SnippetGalleryViewerTester() {
// Initialize the containing Shell
Display display = new Display();
shell = new Shell(display);
shell.setSize(WIDTH, HEIGHT);
shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
GridLayoutFactory.fillDefaults().applyTo(shell);
GalleryTreeViewer viewer = new GalleryTreeViewer(shell);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getGallery());
viewer.setContentProvider(new GalleryTestContentProvider());
viewer.setLabelProvider(new GalleryTestLabelProvider());
viewer.setComparator(new ViewerComparator());
// viewer.addFilter(new OddNumbersFilter());
viewer.setInput(new Object());
// Show the Shell
shell.open();
shell.layout();
// Run the event loop
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}