1 11 package org.eclipse.debug.internal.ui.stringsubstitution; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.resources.ResourcesPlugin; 15 import org.eclipse.core.variables.IStringVariable; 16 import org.eclipse.jface.window.Window; 17 import org.eclipse.swt.widgets.Shell; 18 import org.eclipse.ui.dialogs.ResourceListSelectionDialog; 19 20 23 public class ResourceSelector implements IArgumentSelector { 24 25 28 public String selectArgument(IStringVariable variable, Shell shell) { 29 ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(shell, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE | IResource.FOLDER | IResource.PROJECT); 30 dialog.setTitle(StringSubstitutionMessages.ResourceSelector_0); 31 if (dialog.open() == Window.OK) { 32 Object [] objects = dialog.getResult(); 33 if (objects.length == 1) { 34 return ((IResource)objects[0]).getFullPath().toString(); 35 } 36 } 37 return null; 38 } 39 40 } 41 | Popular Tags |