本文整理汇总了Java中org.eclipse.jface.preference.FieldEditor类的典型用法代码示例。如果您正苦于以下问题:Java FieldEditor类的具体用法?Java FieldEditor怎么用?Java FieldEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FieldEditor类属于org.eclipse.jface.preference包,在下文中一共展示了FieldEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFieldEditors
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
protected void createFieldEditors ()
{
final List<String> tzs = Arrays.asList ( TimeZone.getAvailableIDs () );
Collections.sort ( tzs );
final String[][] entries = new String[tzs.size ()][2];
int i = 0;
for ( final String id : tzs )
{
entries[i][0] = id;
entries[i][1] = id;
i += 1;
}
final FieldEditor field = new ComboFieldEditor ( "timeZone", Messages.TimeZonePreferencePage_TimeZone_Label, entries, getFieldEditorParent () ); //$NON-NLS-1$
addField ( field );
}
示例2: checkState
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* Check if all fields are valid
*
*/
private void checkState() {
if(editorList != null){
int size = editorList.size();
for(int i=0; i<size; i++){
FieldEditor fieldEditor = editorList.get(i);
if(StringUtils.isNotBlank(((StringFieldEditor)fieldEditor).getErrorMessage())){
setErrorMessage(((StringFieldEditor)fieldEditor).getErrorMessage());
setValid(false);
break;
}else{
setValid(true);
}
}
}
}
示例3: createContents
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
public Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fieldEditor = createFieldEditor(container);
fieldEditor.setPage(messages);
fieldEditor.setPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (FieldEditor.IS_VALID.equals(event.getProperty())) {
fireValueChanged(IS_VALID, event.getOldValue(), event.getNewValue());
} else if (FieldEditor.VALUE.equals(event.getProperty())) {
fireValueChanged(VALUE, event.getOldValue(), event.getNewValue());
}
}
});
fieldEditor.setPreferenceStore(getPreferenceStore());
fieldEditor.load();
fieldEditor.fillIntoGrid(container, fieldEditor.getNumberOfControls());
return container;
}
示例4: createPollChangesIntervalGroup
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
private void createPollChangesIntervalGroup(Composite composite) {
Composite groupComposite = new Composite(composite, SWT.LEFT);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
groupComposite.setLayout(layout);
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
groupComposite.setLayoutData(gd);
pollChangesInterval = new IntegerFieldEditor(POLL_CHANGES_INTERVAL_PREF, "Poll changes interval (seconds)",
groupComposite);
pollChangesInterval.setTextLimit(Integer.toString(MAX_POLL_CHANGES_INTERVAL).length());
pollChangesInterval.setErrorMessage("The workspace save interval should be between 30 and 9999.");
pollChangesInterval.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
pollChangesInterval.setValidRange(MIN_POLL_CHANGES_INTERVAL, MAX_POLL_CHANGES_INTERVAL);
pollChangesInterval.setPropertyChangeListener(event -> {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
setValid(pollChangesInterval.isValid());
}
});
addField(pollChangesInterval);
}
示例5: performDefaults
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* The field editor preference page implementation of a <code>PreferencePage</code>
* method loads all the field editors with their default values.
*/
protected void performDefaults()
{
if (fields != null)
{
Iterator e = fields.iterator();
while (e.hasNext())
{
FieldEditor pe = (FieldEditor) e.next();
pe.loadDefault();
}
}
// Force a recalculation of my error state.
checkState();
super.performDefaults();
}
示例6: propertyChange
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* The field editor preference page implementation of this <code>IPreferencePage</code>
* (and <code>IPropertyChangeListener</code>) method intercepts <code>IS_VALID</code>
* events but passes other events on to its superclass.
*/
public void propertyChange(PropertyChangeEvent event)
{
if (event.getProperty().equals(FieldEditor.IS_VALID))
{
boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
// If the new value is true then we must check all field editors.
// If it is false, then the page is invalid in any case.
if (newValue)
{
checkState();
} else
{
setInvalidFieldEditor((FieldEditor) event.getSource());
setValid(newValue);
}
}
}
示例7: checkState
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* Recomputes the page's error state by calling <code>isValid</code> for
* every field editor.
*/
protected void checkState()
{
boolean valid = true;
setInvalidFieldEditor(null);
// The state can only be set to true if all
// field editors contain a valid value. So we must check them all
if (fields != null)
{
int size = fields.size();
for (int i = 0; i < size; i++)
{
FieldEditor editor = (FieldEditor) fields.get(i);
valid = valid && editor.isValid();
if (!valid)
{
setInvalidFieldEditor(editor);
break;
}
}
}
setValid(valid);
}
示例8: createFieldEditor
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
public FieldEditor createFieldEditor(final String name, final String label, final Composite parent, final FieldEditorDetails details) {
final Class<? extends FieldEditor> type = details.getFieldEditorClass();
if (DatabaseComboFieldEditor.class.equals(type)) {
return new DatabaseComboFieldEditor(name, label, details.getLabelsAndValues().toArray(), parent);
}
if (ReaderComboFieldEditor.class.equals(type)) {
return new ReaderComboFieldEditor(name, label, details.getLabelsAndValues().toArray(), parent);
}
if (ThresholdsListEditor.class.equals(type)) {
return new ThresholdsListEditor(name, label, parent);
}
if (WriterComboFieldEditor.class.equals(type)) {
return new WriterComboFieldEditor(name, label, details.getLabelsAndValues().toArray(), parent);
}
return super.createFieldEditor(name, label, parent, details);
}
示例9: propertyChange
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
if (event.getProperty().equals(FieldEditor.VALUE)) {
if (event.getSource() == getCacheHashCodeField()) {
getHashCodeCachingField().setEnabled(getCacheHashCodeField().getBooleanValue(), getFieldEditorParent());
} else if (event.getSource() == getCacheToStringField()) {
getToStringCachingField().setEnabled(getCacheToStringField().getBooleanValue(), getFieldEditorParent());
} else
if (event.getSource() == getHashCodeCachingField() || event.getSource() == getToStringCachingField()) {
checkState();
}
}
}
示例10: createFieldEditors
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* Creates the field editors. Field editors are abstractions of the common GUI
* blocks needed to manipulate various types of preferences. Each field editor
* knows how to save and restore itself.
*/
public void createFieldEditors()
{
this.createBeyondCompareFieldEditors();
this.addField(new EmptyFieldEitor(this.getFieldEditorParent()));
this.createTortoiseFieldEditors("SVN", "TortoiseProc.exe", "TortoiseMerge.exe", PreferenceConstants.TORTOISE_SVN);
this.addField(new EmptyFieldEitor(this.getFieldEditorParent()));
this.createTortoiseFieldEditors("Git", "TortoiseGitProc.exe", "TortoiseGitMerge.exe", PreferenceConstants.TORTOISE_GIT);
/*final String tortoiseHgExecutable = "thg.exe";
this.addField(new EmptyFieldEitor(this.getFieldEditorParent()));
this.createTortoiseFieldEditors("Hg", tortoiseHgExecutable, tortoiseHgExecutable, PreferenceConstants.TORTOISE_HG);
*/
for (BooleanFieldEditor featureEnabledEditor : this.controlMapping.keySet())
{
featureEnabledEditor.setPropertyChangeListener(this);
final boolean featureEnabled = this.getPreferenceStore().getBoolean(featureEnabledEditor.getPreferenceName());
for (FieldEditor fieldEditor : this.controlMapping.get(featureEnabledEditor))
{
fieldEditor.setPropertyChangeListener(this);
fieldEditor.setEnabled(featureEnabled, getFieldEditorParent());
}
}
}
示例11: propertyChange
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
public final void propertyChange(final PropertyChangeEvent event)
{
final Object eventSource = event.getSource();
if (eventSource instanceof BooleanFieldEditor)
{
final BooleanFieldEditor featureEnabledEditor = (BooleanFieldEditor) eventSource;
if (this.controlMapping.keySet().contains(featureEnabledEditor))
{
final boolean featureEnabled = featureEnabledEditor.getBooleanValue();
for (FieldEditor fieldEditor : this.controlMapping.get(featureEnabledEditor))
{
fieldEditor.setEnabled(featureEnabled, getFieldEditorParent());
}
}
}
// Updated the apply button in every case because the property change
// can be caused by a changed string or path value
this.updateApplyButton();
}
示例12: isValid
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
public final boolean isValid()
{
// Search for enabled features wit invalid configuration options
for (BooleanFieldEditor featureEnabledEditor : this.controlMapping.keySet())
{
if (featureEnabledEditor.getBooleanValue() == true)
{
for (FieldEditor fieldEditor : this.controlMapping.get(featureEnabledEditor))
{
if (fieldEditor.isValid() == false)
{
return false;
}
}
}
}
return true;
}
示例13: createFieldEditors
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
@Override
protected void createFieldEditors() {
// Header
header = createHeader();
if (header != null) {
GridDataFactory.fillDefaults().span(Short.MAX_VALUE, 1).applyTo(header);
addSeparator();
}
// Fields
for (final IPreference preference : preferences) {
if (pageDefinition.equals(preference.getPageDefinition())) {
if (preference.isSeparate()) {
addSeparator();
}
final Composite fieldEditorParent = getFieldEditorParent();
final FieldEditor fieldEditor = createFieldEditor(preference, fieldEditorParent);
addField(fieldEditor);
fieldEditorMap.put(preference, new FieldEditorWrapper(fieldEditor, fieldEditorParent));
}
}
universe.putAll(fieldEditorMap);
}
示例14: checkParentsEnabled
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
protected boolean checkParentsEnabled(final Set<IPreference> parents) {
boolean parentEnabled = true;
for (final IPreference preference : parents) {
final FieldEditorWrapper fieldEditorWrapper = universe.get(preference);
if (fieldEditorWrapper == null) {
parentEnabled = getBooleanFromStore(preference);
}
else {
final FieldEditor fieldEditor = fieldEditorWrapper.getFieldEditor();
if (fieldEditor instanceof BooleanFieldEditor) {
try {
parentEnabled = ((BooleanFieldEditor) fieldEditor).getBooleanValue();
}
catch (final NullPointerException e) {
logger.log(Level.FINE, e.toString(), e);
parentEnabled = getBooleanFromStore(preference);
}
}
}
if (!parentEnabled) {
break; // don't waste time
}
}
return parentEnabled;
}
示例15: checkState
import org.eclipse.jface.preference.FieldEditor; //导入依赖的package包/类
/**
* Recomputes the page's error state by calling <code>isValid</code> for every field editor.
*/
protected void checkState() {
boolean valid = true;
m_invalidFieldEditor = null;
// The state can only be set to true if all
// field editors contain a valid value. So we must check them all
if (m_fields != null) {
int size = m_fields.size();
for (int i = 0; i < size; i++) {
FieldEditor editor = m_fields.get(i);
valid = valid && editor.isValid();
if (!valid) {
m_invalidFieldEditor = editor;
break;
}
}
}
setValid(true);
}