private void createTop(Composite parent) { final Composite container = SWTUtil.createGridContainer(parent, 3); // // Source folder // { m_sourceFolderText = SWTUtil.createPathBrowserText( container, "&Source folder:", new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); } // // Package name // { Label label = new Label(container, SWT.NULL); label.setText("&Package name:"); m_packageNameText = new Text(container, SWT.BORDER | SWT.SINGLE); m_packageNameText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); GridData gd = new GridData(GridData.FILL_HORIZONTAL); m_packageNameText.setLayoutData(gd); Button button = new Button(container, SWT.PUSH); button.setText("Browse..."); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleBrowsePackages(container.getShell()); } }); } // // Class name // { Label label = new Label(container, SWT.NULL); label.setText("&Class name:"); m_classNameText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); m_classNameText.setLayoutData(gd); m_classNameText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); } }
private Text addTextLabel(Composite parent, String text) { Text result = SWTUtil.createLabelText(parent, text, null); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.horizontalSpan = 2; result.setLayoutData(gd); return result; }
private void createBottom(Composite parent) { // // Annotations // { Group g = new Group(parent, SWT.SHADOW_ETCHED_OUT); g.setText("Annotations"); GridData gd = new GridData(GridData.FILL_HORIZONTAL); g.setLayoutData(gd); GridLayout layout = new GridLayout(); g.setLayout(layout); layout.numColumns = 3; for (String label : ANNOTATIONS) { if ("".equals(label)) { new Label(g, SWT.NONE); } else { Button b = new Button(g, "".equals(label) ? SWT.None : SWT.CHECK); m_annotations.put(label, b); b.setText("@" + label); } } } // // XML suite file // { Composite container = SWTUtil.createGridContainer(parent, 2); // // Label // Label label = new Label(container, SWT.NULL); label.setText(ResourceUtil.getString("TestNG.newClass.suitePath")); // // Text widget // m_xmlFilePath = new Text(container, SWT.SINGLE | SWT.BORDER); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); gd.grabExcessHorizontalSpace = true; m_xmlFilePath.setLayoutData(gd); } }
private void createUi(Composite wizardParent) { Composite control = new Composite(wizardParent, SWT.NONE); SWTUtil.createGridLayout(control, 1); control.setLayout(new GridLayout()); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // // "Generate testng.xml" box // m_generateBox = new Button(control, SWT.CHECK); m_generateBox.setText("Generate testng.xml"); m_generateBox.setSelection(true); final Group group = new Group(control, SWT.NONE); { group.setLayout(new GridLayout()); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); group.setLayoutData(gd); group.setEnabled(true); } m_generateBox.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { group.setEnabled(((Button) e.getSource()).getSelection()); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); Composite parent = SWTUtil.createGridContainer(group, 3); parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // // Location // m_xmlFile = SWTUtil.createPathBrowserText(parent, "Location:", null); List<JavaElement> elements = Utils.getSelectedJavaElements(); if (elements.size() > 0) { m_xmlFile.setText(elements.get(0).getProject().getPath() + "/testng.xml"); } // // Suite/test name // m_suiteText = addTextLabel(parent, "Suite name:"); m_suiteText.setText(getDefaultSuiteName()); m_testText = addTextLabel(parent, "Test name:"); m_testText.setText(getDefaultTestName()); Composite horizontal = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(6, true); horizontal.setLayout(layout); { GridData gd = new GridData(); gd.horizontalSpan = 3; horizontal.setLayoutData(gd); } // // Selection combo // { Label l = new Label(horizontal, SWT.NONE); l.setText("Class selection:"); m_selectionCombo = new Combo(horizontal, SWT.READ_ONLY); m_selectionCombo.add(Selection.CLASSES.toString()); m_selectionCombo.add(Selection.PACKAGES.toString()); m_selectionCombo.select(0); } // // Parallel mode // { Label l = new Label(horizontal, SWT.NONE); l.setText("Parallel mode:"); m_parallelCombo = new Combo(horizontal, SWT.READ_ONLY); m_parallelCombo.add(XmlSuite.ParallelMode.NONE.toString()); m_parallelCombo.add(XmlSuite.ParallelMode.METHODS.toString()); m_parallelCombo.add(XmlSuite.ParallelMode.CLASSES.toString()); m_parallelCombo.add(XmlSuite.ParallelMode.TESTS.toString()); m_parallelCombo.select(0); } // // Thread count // { Label l = new Label(horizontal, SWT.NONE); l.setText("Thread count:"); m_threadCountText = new Text(horizontal, SWT.BORDER); } // // Preview text // { Label previewLabelText = new Label(parent, SWT.NONE); previewLabelText.setText("Preview"); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.horizontalSpan = 3; previewLabelText.setLayoutData(gd); } { m_previewText = new Text(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.horizontalSpan = 3; m_previewText.setLayoutData(gd); } // // "Code generation" box // m_codeGenerationBox = new Label(control, SWT.CHECK); m_codeGenerationBox.setText("Code generation"); final Group group2 = new Group(control, SWT.NONE); { RowLayout gl = new RowLayout(); // GridLayout gl = new GridLayout(2, true /* same size columns */); group2.setLayout(gl); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); group2.setLayoutData(gd); group2.setEnabled(true); } { Label l = new Label(group2, SWT.NONE); l.setText("suite() methods:"); m_suiteMethodCombo = new Combo(group2, SWT.READ_ONLY); m_suiteMethodCombo.add("Remove"); m_suiteMethodCombo.add("Comment out"); m_suiteMethodCombo.add("Don't touch"); SuiteMethodTreatment lastValue = TestNGPlugin.getPluginPreferenceStore().getSuiteMethodTreatement(); m_suiteMethodCombo.select(lastValue.ordinal()); m_suiteMethodCombo.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { TestNGPlugin.getPluginPreferenceStore() .storeSuiteMethodTreatement(m_suiteMethodCombo.getSelectionIndex()); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); } setControl(control); }