Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2005 IBM Corporation 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 Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.ant.internal.ui.preferences;
 
 
 import java.util.List;
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.TabFolder;
 import  org.eclipse.swt.widgets.TabItem;

Sub-page that allows the user to enter custom types to be used when running Ant build files.
 
 public class AntTypesPage extends AntPage {
    
Creates an instance.
 
 	public AntTypesPage(AntRuntimePreferencePage preferencePage) {
 		super(preferencePage);
 	}
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.ant.internal.ui.preferences.AntPage#addButtonsToButtonGroup(org.eclipse.swt.widgets.Composite)
 	 */
 	protected void addButtonsToButtonGroup(Composite parent) {
 	}

Allows the user to enter a custom type.
 
 	protected void add() {
 		if (dialog.open() == .) {
 			return;
 		}
 
 		Type type = new Type();
 		type.setTypeName(dialog.getName());
 		type.setClassName(dialog.getClassName());
 		addContent(type);
 	}

Creates the tab item that contains this sub-page.
 
 	protected TabItem createTabItem(TabFolder folder) {
 		TabItem item = new TabItem(folder, SWT.NONE);
 		item.setImage(AntObjectLabelProvider.getTypeImage());
 		item.setData(this);
 		Composite top = new Composite(folder, SWT.NONE);
 		top.setFont(folder.getFont());			
 		item.setControl(createContents(top));
 		
 		connectToFolder(itemfolder);
 				
 		return item;
 	}
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.ant.internal.ui.preferences.AntPage#edit(org.eclipse.jface.viewers.IStructuredSelection)
 	 */
 	protected void edit(IStructuredSelection selection) {
 		Type type = (Typeselection.getFirstElement();
 		dialog.setClassName(type.getClassName());
 		dialog.setName(type.getTypeName());
 		if (dialog.open() == .) {
 			return;
 		}
 
 		type.setTypeName(dialog.getName());
		type.setClassName(dialog.getClassName());
	}
	private AddCustomDialog getCustomDialog(String titleString helpContext) {
		Iterator typesgetContents(true).iterator();
		List namesnew ArrayList();
		while (types.hasNext()) {
			Type aTask = (Typetypes.next();
			names.add(aTask.getTypeName());
		}
		AddCustomDialog dialog = new AddCustomDialog(getShell(), getPreferencePage().getLibraryEntries(), nameshelpContext);
		dialog.setTitle(title);
		return dialog;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.AntPage#initialize()
	 */
	protected void initialize() {
		AntCorePreferences prefs= AntCorePlugin.getPlugin().getPreferences();
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.AntPage#getHelpContextId()
	 */
	protected String getHelpContextId() {
	}
New to GrepCode? Check out our FAQ X