Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (38 sloc) 1.472 kb
package scala.tools.eclipse.refactoring.ui
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage
import org.eclipse.ui.PlatformUI
import org.eclipse.jface.dialogs.IMessageProvider
import org.eclipse.swt.widgets.Composite
import org.eclipse.swt.layout.GridData
import org.eclipse.swt.layout.GridLayout
import org.eclipse.swt.SWT
class NewNameWizardPage(
nameChanged: String => Unit,
isValidName: String => Boolean,
defaultName: String,
helpId: String) extends UserInputWizardPage("??") {
setMessage("Note that this is a preview release, make sure to check the generated changes.", IMessageProvider.WARNING)
def createControl(parent: Composite) {
val main = new Composite(parent, SWT.None)
main.setLayout(new GridLayout)
val textField = new LabeledTextField(main, newNameEntered, "New Name:", defaultName)
textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL))
setControl(main)
}
override def setVisible(visible: Boolean) = {
super.setVisible(visible)
if(visible) {
PlatformUI.getWorkbench.getHelpSystem.setHelp(getControl, "org.scala-ide.sdt.core." + helpId)
}
}
def newNameEntered(name: String) {
if(isValidName(name)) {
setPageComplete(true)
setErrorMessage(null)
nameChanged(name)
} else {
setPageComplete(false)
setErrorMessage("The name \""+name +"\" is not a valid identifier.")
}
}
}
Jump to Line
Something went wrong with that request. Please try again.