1 11 package org.eclipse.ui.externaltools.internal.program.launchConfigurations; 12 13 14 import org.eclipse.core.resources.IFile; 15 import org.eclipse.core.resources.ResourcesPlugin; 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.swt.widgets.Composite; 18 import org.eclipse.ui.PlatformUI; 19 import org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab; 20 import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds; 21 import org.eclipse.ui.externaltools.internal.ui.FileSelectionDialog; 22 23 public class ProgramMainTab extends ExternalToolsMainTab { 24 25 30 protected void handleWorkspaceLocationButtonSelected() { 31 FileSelectionDialog dialog; 32 dialog = new FileSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), ExternalToolsProgramMessages.ProgramMainTab_Select); 33 dialog.open(); 34 IStructuredSelection result = dialog.getResult(); 35 if (result == null) { 36 return; 37 } 38 Object file= result.getFirstElement(); 39 if (file instanceof IFile) { 40 StringBuffer expression = new StringBuffer (); 41 expression.append("${workspace_loc:"); expression.append(((IFile)file).getFullPath().toString()); 43 expression.append("}"); locationField.setText(expression.toString()); 45 } 46 } 47 48 49 52 public void createControl(Composite parent) { 53 super.createControl(parent); 54 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_PROGRAM_MAIN_TAB); 55 } 56 } 57 | Popular Tags |