Announcing ScalaPowerPack 0.1

Announcing the release of ScalaPowerPack 0.1.  ScalaPowerPack adds the familiar power of IntelliJ IDEA's automated code inspections and intentions to programming in Scala.  Version 0.1 is just a first step, adding over 20 intentions and inspections to your Scala programming experience.  

ScalaPowerPack also adds the last Java refactoring you'll ever need to IntelliJ IDEA:  "Translate To Scala".   This refactoring powers automated translation from (almost) any Java source to equivalent Scala, and can be run on single-files, individual modules, or entire projects.

ScalaPowerPack 0.1 requires IDEA-10781 and the latest version of the IDEA Scala plugin.  To install ScalaPowerPack, use the IDEA plugin manager, or go to http://plugins.intellij.net/plugin/?id=4485.

--Dave Griffith

4 comments
Comment actions Permalink

Hi, thanks for posting the ScalaPowerPack 0.1. How can I discover the set of supported intentions, inspections and refactors provided by your plugin?  I'm not sure where to look, or how to know whether something is provided by IntelliJ's scala plugin or your ScalaPowerPack plugin.

Also, I tried running a refactor to scala on this file:

package edu.colorado.phet.piccoloscala;

public class TestJava {
    public static void main(String[] args) {
        System.out.println("Testing = " + args);
    }
}

and I received a blank TestJava.scala file, and this error pops up.  I didn't think I was doing anything unusual with my line separators, just using the default IntelliJ formatting options.

Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(154,351),absolute(712,584),button=1,modifiers=Button1,clickCount=1] on ###overrideRedirect###: Wrong line separators: '...s)\n    }\n}\r\n\r\n\n/****...' at offset 146
java.lang.AssertionError: Wrong line separators: '...s)\n    }\n}\r\n\r\n\n/****...' at offset 146
    at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:49)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
    at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:1496)
    at com.intellij.openapi.editor.impl.DocumentImpl.b(DocumentImpl.java:131)
    at com.intellij.openapi.editor.impl.DocumentImpl.a(DocumentImpl.java:110)
    at com.intellij.openapi.editor.impl.DocumentImpl.access$200(DocumentImpl.java:71)
    at com.intellij.openapi.editor.impl.DocumentImpl$4.run(DocumentImpl.java:3)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:40)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:49)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:81)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:50)
    at com.intellij.openapi.editor.impl.DocumentImpl.setText(DocumentImpl.java:179)
    at com.intellij.psi.impl.file.PsiDirectoryImpl.add(PsiDirectoryImpl.java:133)
    at com.intellij.psi.impl.file.PsiJavaDirectoryImpl.add(PsiJavaDirectoryImpl.java:20)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler.doTranslate(TranslateToScalaHandler.java:78)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler.access$000(TranslateToScalaHandler.java:23)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler$1.run(TranslateToScalaHandler.java:29)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:90)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler$2.run(TranslateToScalaHandler.java:37)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:104)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:49)
    at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:81)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler.invoke(TranslateToScalaHandler.java:33)
    at com.sixrr.spp.java2scala.TranslateToScalaHandler.invoke(TranslateToScalaHandler.java:157)
    at com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:4)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:1)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:21)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:96)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:174)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:7)
    at java.awt.Component.processMouseEvent(Component.java:6216)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5981)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4583)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4413)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4413)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:140)
    at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:76)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:145)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Thanks again,
Sam Reid

0
Comment actions Permalink

Same for me, refactoring throws same exception (Windows XP).
Inspections are really interesting, great work!

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Hi Dave,

Browsing through the "Control Flow" intentions, it seems that the
documentation for "Split for loop" is wrong - it seems to be the same as
the documentation/example for "Merge equivalent Ifs To ORed Condition".

The "Split for loop" itself does break my code in some cases. I'll
create and attach a minimal test case later.

Thanks for the effort,
-tt

0
Comment actions Permalink

Dave,

Try "split for loop" on this one:
---
for{
   file <- files
   if file.getName.endsWith(".xml")
   line <- Source.fromFile(file).getLines
   trimmed = line.trim
   if trimmed.matches(pattern)
} println(file + ": " + trimmed)
---

-tt

0

Please sign in to leave a comment.