Search in sources :

Example 6 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testSortJarEntries.

@Test
public void testSortJarEntries() throws Exception {
    String javaHome = getClass().getResource("/temp").getPath() + "/ws/test/gwt-user.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> content = navigation.getPackageFragmentRootContent(project, root.hashCode());
    assertThat(content).isNotNull().isNotEmpty().onProperty("name").containsSequence("about_files", "com.google", "javax", "org", "META-INF", "about.html", "plugin.properties");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 7 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testGetFileBypath.

@Test
public void testGetFileBypath() throws Exception {
    String javaHome = getClass().getResource("/temp").getPath() + "/ws/test/gwt-user.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    JarEntry entry = navigation.getEntry(project, root.hashCode(), "/com/google/gwt/user/User.gwt.xml");
    assertThat(entry).isNotNull();
    assertThat(entry.getType()).isEqualTo(JarEntry.JarEntryType.FILE);
    assertThat(entry.getPath()).isEqualTo("/com/google/gwt/user/User.gwt.xml");
    assertThat(entry.getName()).isEqualTo("User.gwt.xml");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 8 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testPackageCollapsing.

@Test
public void testPackageCollapsing() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/rt.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getChildren(project, root.hashCode(), "org");
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("name").contains("omg", "w3c.dom", "xml.sax");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 9 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testClassFile.

@Test
public void testClassFile() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/rt.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getChildren(project, root.hashCode(), "java.lang");
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("name").contains("Object.class", "String.class", "Integer.class");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 10 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testGetClassByPath.

@Test
@Ignore
public void testGetClassByPath() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/rt.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    JarEntry entry = navigation.getEntry(project, root.hashCode(), "java.lang.Object");
    assertThat(entry).isNotNull();
    assertThat(entry.getType()).isEqualTo(JarEntry.JarEntryType.CLASS_FILE);
    assertThat(entry.getPath()).isEqualTo("java.lang.Object");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

JarEntry (org.eclipse.che.ide.ext.java.shared.JarEntry)23 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)16 File (java.io.File)15 Test (org.junit.Test)15 Operation (org.eclipse.che.api.promises.client.Operation)4 OperationException (org.eclipse.che.api.promises.client.OperationException)4 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)4 Optional (com.google.common.base.Optional)3 Scheduler (com.google.gwt.core.client.Scheduler)3 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)3 OpenEditorCallbackImpl (org.eclipse.che.ide.api.editor.OpenEditorCallbackImpl)3 File (org.eclipse.che.ide.api.resources.File)3 ClassContent (org.eclipse.che.ide.ext.java.shared.dto.ClassContent)3 Project (org.eclipse.che.ide.api.resources.Project)2 Resource (org.eclipse.che.ide.api.resources.Resource)2 SyntheticFile (org.eclipse.che.ide.api.resources.SyntheticFile)2 IClassFile (org.eclipse.jdt.core.IClassFile)2 JarEntryDirectory (org.eclipse.jdt.internal.core.JarEntryDirectory)2 JarEntryFile (org.eclipse.jdt.internal.core.JarEntryFile)2 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1