org.eclipse.xtext.ui.editor.tasks.dialogfields.DialogField Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.tasks.dialogfields.DialogField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected final void updateModel(DialogField field) {
	if (field == taskTags) {
		@SuppressWarnings("unchecked")
		List<TaskTag> list = taskTags.getElements();
		setValue(getTaskTagsKey(), serializeTags(list));
		setValue(getTaskPrioritiesKey(), serializePriorities(list));
	} else if (field == caseSensitiveCheckBox) {
		String state = caseSensitiveCheckBox.isSelected() ? ENABLED : DISABLED;
		setValue(getTasksCaseSensitiveKey(), state);
	}
}
 
Example #2
Source File: NewCheckProjectWizardPage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
private IDialogFieldListener getProjectValueListener() {
  return new IDialogFieldListener() {
    public void dialogFieldChanged(final DialogField field) {
      projectNameStatus = validator.checkProjectName(getProjectName());
      handleFieldChanged(field.toString());
    }
  };
}
 
Example #3
Source File: NewCheckProjectWizardPage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the grammars controls.
 * 
 * @param composite
 *          the composite
 * @param columns
 *          the columns
 */
private void createProjectControls(final Composite composite, final int columns) {
  projectName.setDialogFieldListener(getProjectValueListener());
  projectName.setLabelText(Messages.PROJECT_NAME_LABEL);
  projectName.doFillIntoGrid(composite, columns);

  DialogField.createEmptySpace(composite);

  Text text = projectName.getTextControl(null);
  GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
  text.setLayoutData(gridData);
  projectName.setFocus();
}
 
Example #4
Source File: AbstractN4JSPreferencePage.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** copied from PropertyAndPreferencePage */
@Override
protected Label createDescriptionLabel(Composite parent) {
	parentComposite = parent;
	if (isProjectPreferencePage()) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		GridLayout layout = new GridLayout();
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		IDialogFieldListener listener = new IDialogFieldListener() {
			@Override
			public void dialogFieldChanged(DialogField dialogField) {
				boolean enabled = ((SelectionButtonDialogField) dialogField).isSelected();
				enableProjectSpecificSettings(enabled);
				projectSpecificChanged = true;

				if (enabled && getData() != null) {
					applyData(getData());
				}
			}
		};

		useProjectSettings = new SelectionButtonDialogField(SWT.CHECK);
		useProjectSettings.setDialogFieldListener(listener);
		useProjectSettings
				.setLabelText(
						org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useprojectsettings_label);
		useProjectSettings.doFillIntoGrid(composite, 1);
		LayoutUtil.setHorizontalGrabbing(useProjectSettings.getSelectionButton(null));

		if (offerLink()) {
			changeWorkspaceSettings = createLink(composite,
					org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useworkspacesettings_change);
			changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
		} else {
			LayoutUtil.setHorizontalSpan(useProjectSettings.getSelectionButton(null), 2);
		}

		Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
		horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		horizontalLine.setFont(composite.getFont());
	} else if (supportsProjectSpecificOptions() && offerLink()) {
		changeWorkspaceSettings = createLink(
				parent,
				org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_showprojectspecificsettings_label);
		changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
	}

	return super.createDescriptionLabel(parent);
}
 
Example #5
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void dialogFieldChanged(DialogField field) {
	updateModel(field);
}
 
Example #6
Source File: TaskTagInputDialog.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void dialogFieldChanged(DialogField field) {
	doValidation();
}
 
Example #7
Source File: PropertyAndPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Label createDescriptionLabel(Composite parent) {
	parentComposite = parent;
	if (isProjectPreferencePage()) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		GridLayout layout = new GridLayout();
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		IDialogFieldListener listener = new IDialogFieldListener() {
			@Override
			public void dialogFieldChanged(DialogField field) {
				boolean enabled = ((SelectionButtonDialogField) field).isSelected();
				enableProjectSpecificSettings(enabled);

				if (enabled && getData() != null) {
					applyData(getData());
				}
			}
		};

		useProjectSettings = new SelectionButtonDialogField(SWT.CHECK);
		useProjectSettings.setDialogFieldListener(listener);
		useProjectSettings.setLabelText(Messages.PropertyAndPreferencePage_useprojectsettings_label);
		useProjectSettings.doFillIntoGrid(composite, 1);
		LayoutUtil.setHorizontalGrabbing(useProjectSettings.getSelectionButton(null));

		if (offerLink()) {
			changeWorkspaceSettings = createLink(composite,
					Messages.PropertyAndPreferencePage_useworkspacesettings_change);
			changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
		} else {
			LayoutUtil.setHorizontalSpan(useProjectSettings.getSelectionButton(null), 2);
		}

		Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
		horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		horizontalLine.setFont(composite.getFont());
	} else if (supportsProjectSpecificOptions() && offerLink()) {
		changeWorkspaceSettings = createLink(parent,
				Messages.PropertyAndPreferencePage_showprojectspecificsettings_label);
		changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
	}

	return super.createDescriptionLabel(parent);
}