Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DinisCruz/7954089 to your computer and use it in GitHub Desktop.

Select an option

Save DinisCruz/7954089 to your computer and use it in GitHub Desktop.
import org.eclipse.swt.*;
// creates a new Eclipse view with the the title: 'This is a the view ID and title)'
// the view
def view = eclipseUI.new_View("This is a the view ID and title)").clear();
view.add_Button("first Button"); // add a button
view.add_Text ("this is a text (no border)") // add a Text(box)
view.add_Text (SWT.BORDER).setText("this is a text "); // add a Text(box) with a border
view.add_Text_Search().setText("this is a text with a search icon"); // add a Text(box) that looks like a search box
view.add_Tree().add_Node("1st Node (in a Tree)"); // add a Tree(View) with 1 node
view.add_Button().setText("another Button"); // add a button
//get the composite/parent for the view
def comp = view.composite;
//animate its size by changing the marginHeight and marginWidth
def step = 5
def depth = 75
(0..3).each
{
((0..depth) + (depth..0)).each
{
eclipseUI.asyncExec(new Runnable() { public void run()
{
comp.getLayout().marginHeight = it;
comp.getLayout().marginWidth = it;
view.refresh();
}} );
Thread.sleep(step);
}
}
return "done";
//Config:UIThread_False
import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
//Config:UIThread_False
def viewTitle = "A view to show multiple layouts";
if (eclipseUI.hasView(viewTitle))
eclipseUI.open_View(viewTitle).close();
def view = eclipseUI.new_View();
view.add_Button("first Button");
view.add_Text ("this is a text (no border)");
view.add_Text (SWT.BORDER).setText("this is a text ");
view.add_Text_Search().setText("this is a text with a search icon");
view.add_Tree().add_Node("1st Node (in a Tree)");
view.add_Button().setText("another Button");
view.sleep(1000) // defaults to layout_Fill()
.layout_Row() // row layout
.refresh()
.sleep(1000)
.layout_Grid() // grid layout (horizontal)
.sleep(1000)
.layout(new GridLayout(), SWT.VERTICAL) // grid layout (vertical)
.sleep(1000)
.layout_Form(); // form layout (doesn't do much in this case)
return view.layout();
def viewTitle = "A view to that will be opened and closed";
def view = eclipseUI.new_View(viewTitle);
view.add_Button("a button that will not be there afer close");
view.sleep(1000)
.close();
view = eclipseUI.new_View(viewTitle).sleep(1000);
view.add_Button("A Button");
view.add_Text("Some text");
return view.controls();
def groovyExecution = new GroovyExecution()
String binFolder = "//Users//plugin//_Dev//git//TeamMentor_Eclipse_Plugin//TeamMentor.Eclipse.UxTests//bin//";
groovyExecution.addRefToGroovyShell(binFolder)
def script = """
return tm.utils.Network_Test.fields + tm.utils.Network_Test.test()
"""
groovyExecution.executeScript(script);
return script;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment