On Wednesday, 1 April 2015 at 10:21:46 UTC, Mike James wrote:
Just a thought...

How about adding the keyword 'with' to 'import' to save on typing :-)

import  org.eclipse.swt.widgets.Canvas,
        org.eclipse.swt.widgets.Composite,
        org.eclipse.swt.events.DisposeListener,
        org.eclipse.swt.events.DisposeEvent,
        org.eclipse.swt.events.PaintListener,
        org.eclipse.swt.events.PaintEvent;

import with (org.eclipse.swt) {
        widgets.Canvas,
        widgets.Composite,
        events.DisposeListener,
        events.DisposeEvent,
        events.PaintListener,
        events.PaintEvent;
}


Regards,

-=mike=-

string importSubmodules(string rootModuleName, string[] subModuleNames) {
    import std.algorithm;
    import std.array;

    string prefix = "import " ~ rootModuleName ~ '.';

    return subModuleNames.map!(name => prefix ~ name ~ ';').join
}

mixin(importSubmodules("org.eclipse.swt", [
    "widgets.Canvas",
    "widgets.Composite",
    "events.DisposeListener",
    "events.DisposeEvent",
    "events.PaintListener",
    "events.PaintEvent"
]));

Of course, why be clever here at all and do such things? It's an editor problem. Write the full import lines out, and if you hate typing out the path each time, use tricks in your editor to make that easier, or use an IDE.

Reply via email to