Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add dialog box to "Report Bug" action to show installed Scala plugin

version and Eclipse version.
  • Loading branch information...
commit 4ca7eae68e337681ad24def447808ec7abe2abfd 1 parent 8424863
@lindydonna lindydonna authored
View
5 org.scala-ide.sdt.core/src/scala/tools/eclipse/actions/RunDiagnosticAction.scala
@@ -13,7 +13,6 @@ class RunDiagnosticAction extends IObjectActionDelegate with IWorkbenchWindowAct
val RUN_DIAGNOSTICS = "org.scala-ide.sdt.ui.runDiag.action"
val REPORT_BUG = "org.scala-ide.sdt.ui.reportBug.action"
- val SDT_TRACKER_URL = "http://www.assembla.com/spaces/scala-ide/tickets"
override def init(window: IWorkbenchWindow) {
parentWindow = window
@@ -30,8 +29,8 @@ class RunDiagnosticAction extends IObjectActionDelegate with IWorkbenchWindowAct
val shell = if (parentWindow == null) ScalaPlugin.getShell else parentWindow.getShell
new diagnostic.DiagnosticDialog(shell).open
case REPORT_BUG =>
- val browserSupport = PlatformUI.getWorkbench.getBrowserSupport
- browserSupport.getExternalBrowser.openURL(new java.net.URL(SDT_TRACKER_URL))
+ val shell = if (parentWindow == null) ScalaPlugin.getShell else parentWindow.getShell
+ new diagnostic.ReportBugDialog(shell).open
case _ =>
}
}
View
26 org.scala-ide.sdt.core/src/scala/tools/eclipse/diagnostic/DiagnosticDialog.scala
@@ -51,17 +51,6 @@ class DiagnosticDialog(shell: Shell) extends Dialog(shell) {
protected var delayText: Text = null
protected var boldFont: Font = null
-
- object linkListener extends Listener {
- def handleEvent(e: Event) {
- try {
- val browserSupport = PlatformUI.getWorkbench.getBrowserSupport
- browserSupport.getExternalBrowser.openURL(new java.net.URL(e.text))
- } catch {
- case e: Exception => e.printStackTrace
- }
- }
- }
// protected val markOccurrencesData = new BoolWidgetData(PreferenceConstants.EDITOR_MARK_OCCURRENCES, false)
protected val completionData = new BoolWidgetData("", true) {
@@ -249,7 +238,7 @@ class DiagnosticDialog(shell: Shell) extends Dialog(shell) {
"See <a href=\"http://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F\">" +
"instructions for changing heap size</a>.")
- link.addListener(SWT.Selection, linkListener)
+ link.addListener(SWT.Selection, DiagnosticDialog.linkListener)
}
val otherGroup = newGroup("Additional", control, new GridLayout(1, true))
@@ -257,7 +246,7 @@ class DiagnosticDialog(shell: Shell) extends Dialog(shell) {
val knownIssuesLink = new Link(otherGroup, SWT.NONE)
knownIssuesLink.setText("See list of <a href=\"https://www.assembla.com/wiki/show/scala-ide/Known_Issues\">known issues</a>" +
" for known problems and workarounds")
- knownIssuesLink.addListener(SWT.Selection, linkListener)
+ knownIssuesLink.addListener(SWT.Selection, DiagnosticDialog.linkListener)
errorMessageField = new Text(control, SWT.READ_ONLY | SWT.WRAP)
errorMessageField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL))
@@ -420,4 +409,15 @@ object DiagnosticDialog {
}
}
}
+
+ object linkListener extends Listener {
+ def handleEvent(e: Event) {
+ try {
+ val browserSupport = PlatformUI.getWorkbench.getBrowserSupport
+ browserSupport.getExternalBrowser.openURL(new java.net.URL(e.text))
+ } catch {
+ case e: Exception => e.printStackTrace
+ }
+ }
+ }
}
View
46 org.scala-ide.sdt.core/src/scala/tools/eclipse/diagnostic/ReportBugDialog.scala
@@ -0,0 +1,46 @@
+package scala.tools.eclipse
+
+package diagnostic
+
+import org.eclipse.jface.dialogs.{ Dialog, IDialogConstants }
+
+import org.eclipse.swt.widgets.{ List => SWTList, _ }
+import org.eclipse.swt.layout.{ GridLayout, GridData }
+import org.eclipse.swt.SWT
+import org.eclipse.swt.events.{ ModifyListener, ModifyEvent, SelectionAdapter, SelectionListener, SelectionEvent }
+import org.eclipse.core.runtime.Platform
+
+class ReportBugDialog(shell: Shell) extends Dialog(shell) {
+
+ val SDT_TRACKER_URL = "http://www.assembla.com/spaces/scala-ide/tickets"
+
+ protected override def isResizable = true
+
+ protected override def createDialogArea(parent: Composite): Control = {
+ val control = new Composite(parent, SWT.NONE)
+ control.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true))
+ control.setLayout(new GridLayout)
+
+ val group1 = new Group(control, SWT.SHADOW_NONE)
+ group1.setText("Installation details")
+ group1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true))
+ group1.setLayout(new GridLayout(1, false))
+
+ val messageField = new Text(group1, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER)
+ messageField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL))
+ messageField.setText(
+ "Scala plugin version: " + ScalaPlugin.plugin.getBundle.getVersion + "\n\n" + // padding
+ "Eclipse version: " + Platform.getBundle("org.eclipse.platform").getVersion)
+
+ val reportBugLink = new Link(control, SWT.NONE)
+ reportBugLink.setText("<a href=\"" + SDT_TRACKER_URL + "\">Report a bug</a> on Assembla")
+ reportBugLink.addListener(SWT.Selection, DiagnosticDialog.linkListener)
+
+ control
+ }
+
+ protected override def createButtonsForButtonBar(parent: Composite) {
+ // create only OK button
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true)
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.