Author: scabanovich
Date: 2010-04-26 08:17:46 -0400 (Mon, 26 Apr 2010)
New Revision: 21687
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.classpath
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.project
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/org.eclipse.jdt.core.prefs
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/bin/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/lib/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/lib/test.jar
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/src/
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/src/placeholder.txt
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/JarPropertiesTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5854
Modified: trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF 2010-04-26
12:16:42 UTC (rev 21686)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF 2010-04-26
12:17:46 UTC (rev 21687)
@@ -7,6 +7,8 @@
org.eclipse.jface,
org.jboss.tools.tests,
org.eclipse.ui,
+ org.eclipse.jdt.ui,
+ org.eclipse.ui.ide,
org.jboss.tools.common,
org.jboss.tools.common.model.ui,
org.jboss.tools.common.test
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.classpath
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.classpath
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.classpath 2010-04-26
12:17:46 UTC (rev 21687)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="lib" path="lib/test.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.project
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.project
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.project 2010-04-26
12:17:46 UTC (rev 21687)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TestJarProperties</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/org.eclipse.jdt.core.prefs 2010-04-26
12:17:46 UTC (rev 21687)
@@ -0,0 +1,12 @@
+#Tue Apr 13 19:12:52 MSD 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/lib/test.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/lib/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/src/placeholder.txt
===================================================================
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/projects/TestJarProperties/src/placeholder.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/JarPropertiesTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/JarPropertiesTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/JarPropertiesTest.java 2010-04-26
12:17:46 UTC (rev 21687)
@@ -0,0 +1,85 @@
+package org.jboss.tools.common.model.ui.jarproperties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.internal.core.JarEntryDirectory;
+import org.eclipse.jdt.internal.core.JarEntryFile;
+import org.eclipse.jdt.internal.core.JarEntryResource;
+import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.propertieseditor.PropertiesCompoundEditor;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+import junit.framework.TestCase;
+
+public class JarPropertiesTest extends TestCase {
+ private static final String PROJECT_NAME = "TestJarProperties";
+ TestProjectProvider provider = null;
+ protected IProject project = null;
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.common.model.ui.test",
null, PROJECT_NAME, false);
+ project = provider.getProject();
+ }
+
+ public void testOpenJarProperties() {
+ IResource jar = project.getFile("/lib/test.jar");
+ JarEntryFile f = getJarEntryFileForResource(project, jar, "org.test",
"LogStrings.properties");
+ IWorkbenchPage page =
ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorInput input = new JarEntryEditorInput(f);
+ try {
+ IEditorPart editor = page.openEditor(input,
"org.jboss.tools.common.propertieseditor.PropertiesCompoundEditor");
+ assertEquals(editor.getClass().getName(), PropertiesCompoundEditor.class.getName());
+ PropertiesCompoundEditor p = (PropertiesCompoundEditor)editor;
+ IEditorInput e1 = p.getEditorInput();
+ if(e1 instanceof IModelObjectEditorInput) {
+ IModelObjectEditorInput moei = (IModelObjectEditorInput)e1;
+ assertNotNull(moei.getXModelObject());
+ } else {
+ fail("Editor input is not instanceof IModelObjectEditorInput: " +
e1.getClass().getName());
+ }
+
+ } catch (PartInitException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ JarEntryFile getJarEntryFileForResource(IProject p, IResource file, String packageName,
String fileName) {
+ JarEntryFile f = new JarEntryFile(fileName);
+ JarEntryResource current = f;
+
+ IJavaProject jp = EclipseResourceUtil.getJavaProject(p);
+ if(jp == null) return null;
+
+ IPackageFragmentRoot root = jp.getPackageFragmentRoot(file);
+ if(root == null) return null;
+
+ if(current != null && !"META-INF".equalsIgnoreCase(current.getName())
&& packageName.length() > 0) {
+ IPackageFragment pf = root.getPackageFragment(packageName);
+ f.setParent(pf);
+ } else {
+ current.setParent(root);
+ }
+
+ return f;
+ }
+
+
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ project = null;
+ }
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/jarproperties/JarPropertiesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2010-04-26
12:16:42 UTC (rev 21686)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2010-04-26
12:17:46 UTC (rev 21687)
@@ -17,6 +17,7 @@
import org.jboss.tools.common.core.jdt.test.FavoritesClassControllerTest;
import org.jboss.tools.common.model.ui.dialog.test.ErrorDialogTest;
import org.jboss.tools.common.model.ui.dialog.test.MessageAndCheckboxDialogTest;
+import org.jboss.tools.common.model.ui.jarproperties.JarPropertiesTest;
import org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesPage;
import org.jboss.tools.common.model.ui.reporting.ReportProblemWizardTest;
@@ -36,6 +37,7 @@
suite.addTestSuite(ErrorDialogTest.class);
suite.addTestSuite(MessageAndCheckboxDialogTest.class);
suite.addTestSuite(ReportProblemWizardTest.class);
+ suite.addTestSuite(JarPropertiesTest.class);
return suite;
}