Skip to content

Instantly share code, notes, and snippets.

//var topPanel = panel.add_Panel(true);
var topPanel = "Util - Browse TeamMentor Libraries v1.0".popupWindow(800,500);
topPanel.insert_LogViewer();
//var defaultServer = "http://localhost:12120";
var defaultServer = "https://owasp.teammentor.net";
var defaultUsername = "";
var defaultPassword = "";
var stopRequests = false;
@DinisCruz
DinisCruz / 1. multiple experimentations.groovy
Last active December 30, 2015 22:19
Multiple ways I tried to figure out the best way to execute a script in the Fortify Class loader
def fortifyAPI = tm.eclipse.ui.Startup.loadedPlugins.first()
def issuesList = fortifyAPI.getIssuesListView()
def tree = issuesList.tree.getTree();
//return String.format("%s \n %s " , this.class.getClassLoader() , issuesList.class.getClassLoader());
def _eclipse = eclipse
def groovyExecution = new GroovyExecution();
def folder = "/Users/plugin/_Dev/eclipses/QA - Fortify - Kepler/plugins/com.fortify.plugin.remediation_3.90.0/Core/lib/";
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
@DinisCruz
DinisCruz / 1. first pass with lots of SWT code.groovy
Created December 17, 2013 17:47
Creating a view that shows a list of images from ISharedImages
//Config:UIThread__False
import org.eclipse.jface.dialogs.*
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
def panel = eclipseUI.new_Panel("view images").clear()
def binFolder = GroovyExecution.class.getProtectionDomain().getCodeSource().getLocation();
def unitTests = new URL(binFolder, "../../TeamMentor.Eclipse.UxTests/bin/");
def groovyExecution = new GroovyExecution();
groovyExecution.addRefToGroovyShell(unitTests.getPath() + "/");
groovyExecution.execute_JUnit_Test("tm.eclipse.helpers.Images_Test");
return groovyExecution
@DinisCruz
DinisCruz / 1. Create a view and use it to see a particular preferences page UI.groovy
Last active December 31, 2015 17:59
Dynamically programming Eclipse preferences page
import tm.eclipse.ui.PluginPreferences.*;
def mainPreferences = new MainPreferences();
def viewId = "test login preferences";
eclipseUI.add_View(viewId).close()
def view = eclipseUI.add_View(viewId);
mainPreferences.control = view.composite;
mainPreferences.createContents(view.composite)
import java.io.IOException;
public class PoC_XMLGenerator
{
public static void main(String[] args) throws IOException
{
String process = "open";
String arguments = "/Applications/Calculator.app";
/*<!--<method>
<class>com.foo.MyThing</class>
<name>doStuff</name>
<parameter-types>
<class>java.lang.String</class>
<class>java.util.Iterator</class>
</parameter-types>
</method>()-->
*/
def groovyExecution = new GroovyExecution();
@DinisCruz
DinisCruz / 1. Move Mouse to X Y location.groovy
Last active January 2, 2016 00:39
Misc Eclipse SWT scripts
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.widgets.*;
def e = new Event();
e.type = SWT.MouseMove
for(int i : 1..50)
{
e.x = 100 + i * 10;
e.y = 200 + i;
def inputJavaElement = eclipse.editors.compilationUnits().first().getInputJavaElement()
def compilationUnit = inputJavaElement.getCompilationUnit();
def type = compilationUnit.getTypes()[0];
def method = type.getMethods()[0];
//inspect(method)
return method.source;