Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2005, 2007 BEA Systems, Inc. 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 Contributors: wharley@bea.com - initial API and implementation /
 
 
 package org.eclipse.jdt.apt.ui.internal.preferences;
 
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.Control;
 import  org.eclipse.swt.widgets.Label;
 import  org.eclipse.swt.widgets.Shell;
Dialog to display "advanced options" on a FactoryPathEntry, typically in the context of the factory path config UI. Advanced options are those which do not normally need to be configured, and which may require deeper-than-usual understanding of the annotation processing architecture.
 
 public class AdvancedFactoryPathOptionsDialog extends Dialog {
 	
 	private final static int LIST_WIDTH= 70; // width (in chars) of factory list
 	private final static int LIST_HEIGHT= 10; // number of lines in factory list
 	
 	private class FieldAdapter implements IDialogFieldListener {
 		public void dialogFieldChanged(DialogField field) {
 		}
 	}
 	
 	// shallow copies, because they are not changed by this code
 	private final FactoryContainer _fc;
 	private final FactoryPath.Attributes _attr;
 	
 	// Dialog controls
 	
 			Shell parentFactoryContainer fcFactoryPath.Attributes attr) {
 		super(parent);
 		setShellStyle(getShellStyle() | SWT.RESIZE);
 		fc;
 		attr;
 	}
 	
     protected void configureShell(Shell shell) {
         super.configureShell(shell);
     }
     
 	protected Control createDialogArea(Composite parent) {
 		Composite dlgArea= (Composite) super.createDialogArea(parent);
 		
 		// Set up "batch mode" checkbox.
 		FieldAdapter adapter = new FieldAdapter();
 			// Plugins can't run in APT compatibility mode.
 		boolean isPlugin = .getType() == ..;
 		
 		DialogField.createEmptySpace(dlgArea, 1);
 
 		// Set up label for processor contents list
 		Label descriptionnew Label(dlgArea, SWT.WRAP);
 		GridData gdLabelnew GridData(GridData.HORIZONTAL_ALIGN_FILL);
 		gdLabel.horizontalSpan= 2;
 		description.setLayoutData(gdLabel);
 
 		// Set up processor contents list
 		new ListViewer(dlgArea, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
         GridData data = new GridData(SWT.FILL, SWT.FILL, truetrue);
         data.heightHint = convertHeightInCharsToPixels();
        data.widthHint = convertWidthInCharsToPixels();
        .getList().setLayoutData(data);
        .getList().setFont(parent.getFont());
        try {
	        for (Entry<StringStringentry : .getFactoryNames().entrySet()) {
	        	String name = entry.getKey();
	        	.add(name);
	        	//TODO: display the processor type (i.e., entry.getValue())
	        }
        }
        catch (IOException e) {
			final String message = "Unable to load factory names from container [" + .getId() + "]"//$NON-NLS-1$ //$NON-NLS-2$
			ExceptionHandler.log(emessage);
        }
        .setSelection(nullfalse);
        
		applyDialogFont(dlgArea);		
		return dlgArea;
	}

Return a new Attributes representing the original value updated with any changes made by the user. Changes will be included even if the dialog was cancelled, so this should only be called if the dialog returned OK.
		boolean batchMode = .isSelected();
		return new FactoryPath.Attributes(.isEnabled(), batchMode);
	}
New to GrepCode? Check out our FAQ X