Community
Participate
Working Groups
Build Identifier: I20100608-0911 This issue relates to the New Project wizard (activated by "New" -> "General" -> "Project"). Specifically, the wizard classes in question are "org.eclipse.ui.dialogs.WizardNewProjectCreationPage", and its dependency "org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea". The current implementation of selecting the "Use default location" button is to set the enabled state of the project location text control to false. However, this state does not enable the user to see the entire path for very long pathnames and more importantly does not allow the user to copy the default location. Therefore, for abnormally long pathnames on systems with limited screen area, the user is unable to determine the value of the default location path. I have implemented a simple solution that fixes this bug - someone just needs to insert the code into the Eclipse code base. Essentially, it recreates the project location text control upon every selection of the "Use default location" button, toggling between SWT.READ_ONLY text styles. Here are the main code snippets, which I have verified to work: // following code is to replace creation of text field Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Text textField = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); // initialize to read-only textField.setFont(parent.getFont()); textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; textField.setLayoutData(gd); // following code is modified from org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea useDefaultsButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean useDefaults = useDefaultsButton.getSelection(); textField = recreateProjectTextField(textField, composite, useDefaults); String error = checkValidLocation(); errorReporter.reportError(error, error != null && error.equals(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectLocationEmpty)); // !!! The following function need to be modified to remove reference to text field !!! setUserAreaEnabled(!useDefaults); } }); // new function to recreate location text in its own composite when default button is toggled Text recreateProjectTextField(Text text, Composite parent, boolean defaultSelected) { int options = SWT.NONE; String newTextContents; if (defaultSelected) { options = SWT.READ_ONLY; userPath = text.getText(); newTextContents = TextProcessor.process(getDefaultPathDisplayString()); } else { newTextContents = TextProcessor.process(userPath); } text.dispose(); // dispose the text field textField = new Text(parent, SWT.SINGLE | SWT.BORDER | options); textField.setFont(parent.getFont()); textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; textField.setLayoutData(gd); newText.setText(newTextContents); parent.layout(); // text field won't reappear without this line return newText; } Reproducible: Always
kvn_m, Appreciate you looking into the code and suggesting a fix. Would you like to contribute a proper patch for the code? Check http://wiki.eclipse.org/Platform_UI/How_to_Contribute for more info on contributing patches.
Had a look into this. No plans to fix this one.