Skip to content

Commit

Permalink
impl TestNGContainerWizardPage so that users can add "TestNG Library"
Browse files Browse the repository at this point in the history
via
"Build Path -> Add Libraries... -> TestNG"
  • Loading branch information
missedone committed Jan 5, 2012
1 parent 6dd335f commit d1b9a46
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
Binary file added icons/full/wizban/addlibrary_wiz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,13 @@

</menuContribution>
</extension>
<extension
point="org.eclipse.jdt.ui.classpathContainerPage">
<classpathContainerPage
class="org.testng.eclipse.ui.buildpath.TestNGContainerWizardPage"
id="org.testng.TESTNG_CONTAINER"
name="TestNG">
</classpathContainerPage>
</extension>

</plugin>
3 changes: 3 additions & 0 deletions src/main/org/testng/eclipse/TestNGMessages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ NewTestNGClassWizard.alreadyExists.message=File {0} already exists. Overwrite it
TestNGMethodWizardPage.description=Select which methods you'd like to test.

TestNGContainerWizardPage.title=TestNG Library
TestNGContainerWizardPage.description=Set the TestNG Library for this project.
TestNGContainerWizardPage.message=This will set the default TestNG Library to this project.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.testng.eclipse.ui.buildpath;

import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.testng.eclipse.TestNGPlugin;
import org.testng.eclipse.buildpath.TestNGContainerInitializer;
import org.testng.eclipse.util.ResourceUtil;

public class TestNGContainerWizardPage extends WizardPage implements IClasspathContainerPage {

public TestNGContainerWizardPage() {
super("TestNGContainerWizardPage"); //$NON-NLS-1$
setTitle(ResourceUtil.getString("TestNGContainerWizardPage.title")); //$NON-NLS-1$
setDescription(ResourceUtil.getString("TestNGContainerWizardPage.description")); //$NON-NLS-1$
setImageDescriptor(TestNGPlugin.getImageDescriptor("wizban/addlibrary_wiz.png")); //$NON-NLS-1$
}

public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
container.setLayout(layout);

new Label(container, SWT.NONE).setText(ResourceUtil.getString("TestNGContainerWizardPage.message")); //$NON-NLS-1$

setControl(container);
Dialog.applyDialogFont(container);
}

public boolean finish() {
return true;
}

public IClasspathEntry getSelection() {
return JavaCore.newContainerEntry(TestNGContainerInitializer.TESTNG_PATH);
}

public void setSelection(IClasspathEntry containerEntry) {
}

}

0 comments on commit d1b9a46

Please sign in to comment.