Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
  
  package org.eclipse.xtext.ui.preferences;
  
 import  org.eclipse.jface.preference.FieldEditor;
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.events.SelectionEvent;
 import  org.eclipse.swt.events.SelectionListener;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.layout.GridLayout;
 import  org.eclipse.swt.widgets.Button;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.Group;
 import  org.eclipse.swt.widgets.Label;
 

Author(s):
Dennis Huebner - Initial contribution and API
 
 public class ResetPromptDialogSettingsField extends FieldEditor {
 
 	private Group dontAskGroup;
 
 	public int getNumberOfControls() {
 		return 1;
 	}
 
 	public FieldEditor getFieldEditor(Composite parent) {
 		return createField(parentgetNumberOfControls());
 	}
 
 	protected void doStore() {
 	}
 
 	protected void doLoadDefault() {
 	}
 
 	protected void doLoad() {
 	}
 
 	protected void doFillIntoGrid(Composite parentint numColumns) {
 		createField(parentnumColumns);
 	}
 
 	protected ResetPromptDialogSettingsField createField(Composite parentint colums) {
 		if ( == null) {
 			GridLayout layout = new GridLayout(2, false);
 			layout.marginHeight = 0;
 			layout.marginWidth = 0;
 			 = new Group(parent, SWT.NONE);
 			.setLayout(layout);
 			GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
 			gridData.horizontalSpan = colums;
 			.setLayoutData(gridData);
 
 			Label label = new Label(, SWT.WRAP);
 			label.setFont(parent.getFont());
 			GridData data = new GridData(GridData.FILL, GridData.CENTER, truefalse);
 			data.widthHint = new PixelConverter(parent).convertHorizontalDLUsToPixels(40);
 			label.setLayoutData(data);
 
 			Button clearButton = new Button(, SWT.PUSH);
 			clearButton.setText("&Clear"); //$NON-NLS-1$
 			GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING, falsefalse);
 			clearButton.setLayoutData(layoutData);
 			clearButton.addSelectionListener(new SelectionListener() {
 				public void widgetSelected(SelectionEvent e) {
 				}
 
 				public void widgetDefaultSelected(SelectionEvent e) {
 				}
 			});
 			layoutData.widthHint = SWTUtil.getButtonWidthHint(clearButton);
 		}
 		return this;
 	}
	private void unhideAllDialogs() {
	}
	protected void adjustForNumColumns(int numColumns) {
		if ( != null) {
			GridData gd = (GridData) .getLayoutData();
			gd.horizontalSpan = numColumns;
		}
	}
New to GrepCode? Check out our FAQ X