well I work in intelij IDEA. So setUp to write selenium tests e.g. be the following:
1) install maven
- Unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip to
the directory you wish to install Maven 3.0.4. These instructions
assume you chose C:\Program Files\Apache Software Foundation. The
subdirectory apache-maven-3.0.4 will be created from the archive.
- Add the M2_HOME environment variable by opening up the system
properties (WinKey + Pause), selecting the "Advanced" tab, and the
"Environment Variables" button, then adding the M2_HOME variable
in the user variables with the value C:\Program Files\Apache
Software Foundation\apache-maven-3.0.4. Be sure to omit any
quotation marks around the path even if it contains spaces.
- In the same dialog, add the M2 environment variable in the user
variables with the value %M2_HOME%\bin.
2) install jdk
3) 
4) verify that all environment variables you've set properly
5) run intelij IDEA
select Project structure to set up installed JDK
6)
press New.select jsdk. write path where we installed java, e.g C:\Program Files\Java\jdk1.6.0_29
7)create new project from scratch
8) maven module
9)
10)
11) add to POM appropriate dependencies:

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.24.1</version>
</dependency>
12) if still someting underline with red line , press alt+enter on it >> idea should automatically suggest autoimport.
13)test structure in the project

14)common structure of selenium test
import com.thoughtworks.selenium.SeleneseTestBase;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class HomePageTest extends SeleneseTestBase{
static WebDriver driver;
@Before
public void openFirefox(){
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
@Test
public void testHomePage(){
driver.get("https://www.google.by/");
WebElement search = driver.findElement(By.xpath("//*[@id=\"gbqfq\"]"));
search.sendKeys("laptop");
search.submit();
}
@After
public void closeFirefox(){
// driver.quit();
}
}
15) also don't forget that you can export your created test in selenium IDE as JUNIT4- selenium and open them in IDEA

Regards