Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 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.graphics.Font;
 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.TabFolder;
 import  org.eclipse.swt.widgets.TabItem;
Preference page for setting global Ant user properties. All properties specified here will be set as user properties on the project for any Ant build
 
 public class AntPropertiesPage implements IAntBlockContainer {
 	
Creates an instance.
 
 	public AntPropertiesPage(AntRuntimePreferencePage preferencePage) {
 		this.preferencePage;
 	}

Creates the tab item that contains this sub-page.
 
 	protected TabItem createTabItem(TabFolder folder) {
 		TabItem item = new TabItem(folder, SWT.NONE);
 		item.setImage(AntObjectLabelProvider.getPropertyImage());
 		item.setData(this);
 		item.setControl(createContents(folder));
 		return item;
 	}
 	
 	protected Composite createContents(Composite parent) {
 		Font font = parent.getFont();
 		
 		Composite top = new Composite(parent, SWT.NONE);
 		top.setFont(font);
 		GridLayout layout = new GridLayout();
 		layout.numColumns= 2;
 		top.setLayout(layout);
 		GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
 		top.setLayoutData(gridData); 
 				
 		
 		return top;
 	}

Sets the contents of the tables on this page.
 
 	protected void initialize() {
 		List allProperties= AntCorePlugin.getPlugin().getPreferences().getDefaultProperties();
 		allProperties.addAll(Arrays.asList(AntCorePlugin.getPlugin().getPreferences().getCustomProperties()));
 		.setPropertiesInput((Property[]) allProperties.toArray(new Property[allProperties.size()]));
 	}
 	
 	protected void performDefaults() {
 		List defaultProperties= AntCorePlugin.getPlugin().getPreferences().getDefaultProperties();
 		.setPropertiesInput((Property[]) defaultProperties.toArray(new Property[defaultProperties.size()]));
 	}

Delegates to saving any additional table settings when the page is closed

Since:
3.5
 
 	public void saveAdditionalSettings() {
	}

Returns the specified property files

Returns:
String[]
	protected String[] getPropertyFiles() {
		String[] filesnew String[elements.length];
		for (int i = 0; i < elements.lengthi++) {
			files[i] = (String)elements[i];
		}
		return files;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.IAntBlockContainer#setMessage(java.lang.String)
	 */
	public void setMessage(String message) {
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.IAntBlockContainer#setErrorMessage(java.lang.String)
	 */
	public void setErrorMessage(String message) {
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.IAntBlockContainer#createPushButton(org.eclipse.swt.widgets.Composite, java.lang.String)
	 */
	public Button createPushButton(Composite parentString buttonText) {
		Button button = new Button(parent, SWT.PUSH);
		button.setFont(parent.getFont());
		button.setText(buttonText);
		return button;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ant.internal.ui.preferences.IAntBlockContainer#update()
	 */
	public void update() {
	}
	protected List getProperties() {
		List propertiesnew ArrayList(allProperties.length);
		for (int i = 0; i < allProperties.lengthi++) {
			Property property = (Property)allProperties[i];
			if (!property.isDefault()) {
				properties.add(property);
			}
		}
		return properties;
	}
New to GrepCode? Check out our FAQ X