private void updateURLEnabled(ILaunchConfiguration configuration) throws CoreException { boolean enabled = configuration.getAttribute(SERVER_ENABLED, true); fURLLabel.getParent().setVisible(enabled); if (enabled) { fURLPath.setEnabled(!autoGeneratedURL.getSelection()); } }
/** @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration) */ public void initializeFrom(ILaunchConfiguration configuration) { serverCombo.setEnabled(true); // remove error message that other instances may have set setErrorMessage(null); try { String fileName = configuration.getAttribute(Server.FILE_NAME, ""); // $NON-NLS-1$ String url = configuration.getAttribute(Server.BASE_URL, ""); // $NON-NLS-1$ boolean isAutoGeneratedURL = configuration.getAttribute(AUTO_GENERATED_URL, true); initializeServerControl(configuration); if (isAutoGeneratedURL) { autoGeneratedURL.setSelection(true); String computedURL = computeURL(formatFileName(fileName)); fURLLabel.setEnabled(false); updateURLComponents(computedURL); fURLPath.setEnabled(false); } else { autoGeneratedURL.setSelection(false); fURLLabel.setEnabled(true); updateURLComponents(url); fURLPath.setEnabled(true); } fFile.setText(fileName); updateFileEnabled(configuration); updateURLEnabled(configuration); } catch (CoreException e) { // ignore } initializeExtensionControls(configuration); isValid(configuration); }
public void createURLControl(Composite composite) { Group group = new Group(composite, SWT.NONE); String projectLabel = PHPServerUIMessages.getString("ServerTab.url"); // $NON-NLS-1$ group.setText(projectLabel); group.setLayout(new GridLayout(2, false)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); autoGeneratedURL = new Button(group, SWT.CHECK); autoGeneratedURL.setText( PHPServerUIMessages.getString("ServerTab.autoGenerate")); // $NON-NLS-1$ autoGeneratedURL.setSelection(true); autoGeneratedURL.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); autoGeneratedURL.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { initializeURLControl(); updateLaunchConfigurationDialog(); } }); fURLLabel = new Label(group, SWT.NONE); fURLLabel.setText(PHPServerUIMessages.getString("ServerTab.urlLabel")); // $NON-NLS-1$ GridData gridData = new GridData(); gridData.horizontalIndent = 20; gridData.horizontalSpan = 1; fURLLabel.setLayoutData(gridData); Composite urlComposite = new Composite(group, SWT.NONE); urlComposite.setLayout(new GridLayout(2, false)); urlComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLHost = new Text(urlComposite, SWT.SINGLE | SWT.BORDER); fURLHost.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLHost.setEnabled(false); fURLPath = new Text(urlComposite, SWT.SINGLE | SWT.BORDER); fURLPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLPath.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { updateLaunchConfigurationDialog(); } }); }