protected void initializeServerControl(ILaunchConfiguration configuration) { try { String serverName = configuration.getAttribute(Server.NAME, ""); // $NON-NLS-1$ if (serverName != null && !serverName.equals("")) { // $NON-NLS-1$ server = ServersManager.getServer(serverName); if (server == null) { // server no longer exists setErrorMessage( PHPServerUIMessages.getString("ServerTab.invalidServerError")); // $NON-NLS-1$ selectDefaultServer(configuration); } else { serverCombo.setText(server.getName()); } } else { selectDefaultServer(configuration); } // flag should only be set if launch has been attempted on the // config if (configuration.getAttribute(READ_ONLY, false)) { serverCombo.setEnabled(false); } boolean enabled = configuration.getAttribute(SERVER_ENABLED, true); serverCombo.setEnabled(enabled); createNewServer.setEnabled(enabled); } catch (Exception e) { } }
/** @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); }