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.launchConfigurations;
import  org.eclipse.swt.widgets.DirectoryDialog;

Edits the Ant Home classpath entry.

Since:
3.0
	private AntClasspathTab fTab;
Constructs an action to edit the Ant Home setting for a launch config.

Parameters:
viewer classpath viewer
		 = tab;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jface.action.IAction#run()
	 */
	public void run() {
		IDialogSettings dialogSettings = AntUIPlugin.getDefault().getDialogSettings();
		String lastUsedPathdialogSettings.get(.);
		if (lastUsedPath == null) {
			lastUsedPath= ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
		}
		DirectoryDialog dialog = new DirectoryDialog(getShell());
		dialog.setFilterPath(lastUsedPath);
		String path = dialog.open();
		if (path == null) {
			return;
		}
		AntCorePreferences preferences = AntCorePlugin.getPlugin().getPreferences();
		String defaultHome = preferences.getAntHome();
		if (path.equalsIgnoreCase(defaultHome)) {
			path = null;
		}
		// update existing entry or add a new one
		for (int i = 0; i < entries.lengthi++) {
			IRuntimeClasspathEntry entry = entries[i];
			if (entry.getType() == .) {
					getViewer().refresh(entry);
					return;
				}
			}
		}				
		// no entry found - add a new one
	}

See also:
SelectionListenerAction.updateSelection(IStructuredSelection)
	protected boolean updateSelection(IStructuredSelection selection) {
		return true;
	}	
New to GrepCode? Check out our FAQ X