Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 212285 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/java/tests/AllJavaTests.java (-1 / +1 lines)
Lines 38-44 Link Here
38
		suite.addTestSuite(ContentSpecificContextTest.class);
38
		suite.addTestSuite(ContentSpecificContextTest.class);
39
		suite.addTestSuite(ResourceStructureMappingTest.class);
39
		suite.addTestSuite(ResourceStructureMappingTest.class);
40
		// XXX: Put back
40
		// XXX: Put back
41
		//suite.addTestSuite(InterestManipulationTest.class);
41
		suite.addTestSuite(InterestManipulationTest.class);
42
		suite.addTestSuite(EditorManagerTest.class);
42
		suite.addTestSuite(EditorManagerTest.class);
43
		suite.addTestSuite(RefactoringTest.class);
43
		suite.addTestSuite(RefactoringTest.class);
44
		suite.addTestSuite(ContentOutlineRefreshTest.class);
44
		suite.addTestSuite(ContentOutlineRefreshTest.class);
(-)src/org/eclipse/mylyn/java/tests/InterestManipulationTest.java (-2 / +44 lines)
Lines 29-34 Link Here
29
29
30
/**
30
/**
31
 * @author Mik Kersten
31
 * @author Mik Kersten
32
 * @author Shawn Minto
32
 */
33
 */
33
public class InterestManipulationTest extends AbstractJavaContextTest {
34
public class InterestManipulationTest extends AbstractJavaContextTest {
34
35
Lines 62-67 Link Here
62
		super.tearDown();
63
		super.tearDown();
63
	}
64
	}
64
65
66
	public void testDecrementNonJavaProject() throws CoreException, InvocationTargetException, InterruptedException {
67
		IFile file = nonJavaProject.getProject().getFile("foo.txt");
68
		file.create(null, true, null);
69
		ResourceStructureBridge bridge = new ResourceStructureBridge();
70
		new ResourceInteractionMonitor().selectionChanged(part, new StructuredSelection(file));
71
72
		IInteractionElement fileElement = ContextCorePlugin.getContextManager().getElement(
73
				bridge.getHandleIdentifier(file));
74
75
		IInteractionElement projectElement = ContextCorePlugin.getContextManager().getElement(
76
				new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject()));
77
78
		assertTrue(fileElement.getInterest().isInteresting());
79
		assertTrue(projectElement.getInterest().isInteresting());
80
		
81
		assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(projectElement, false, false,
82
				false, "test"));
83
84
		projectElement = ContextCorePlugin.getContextManager().getElement(
85
				new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject()));
86
		
87
		fileElement = ContextCorePlugin.getContextManager().getElement(
88
				bridge.getHandleIdentifier(file));
89
		
90
		assertFalse(projectElement.getInterest().isInteresting());
91
		assertFalse(fileElement.getInterest().isInteresting());
92
	}
93
	
65
	public void testDecrementAcrossBridges() throws CoreException, InvocationTargetException, InterruptedException {
94
	public void testDecrementAcrossBridges() throws CoreException, InvocationTargetException, InterruptedException {
66
		monitor.selectionChanged(part, new StructuredSelection(javaMethod));
95
		monitor.selectionChanged(part, new StructuredSelection(javaMethod));
67
		method = ContextCorePlugin.getContextManager().getElement(javaMethod.getHandleIdentifier());
96
		method = ContextCorePlugin.getContextManager().getElement(javaMethod.getHandleIdentifier());
Lines 83-88 Link Here
83
		assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(projectElement, false, false,
112
		assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(projectElement, false, false,
84
				false, "test"));
113
				false, "test"));
85
114
115
		fileElement = ContextCorePlugin.getContextManager().getElement(
116
				bridge.getHandleIdentifier(file));
86
		assertFalse(fileElement.getInterest().isInteresting());
117
		assertFalse(fileElement.getInterest().isInteresting());
87
		// TODO: re-enable, fails in AllTests
118
		// TODO: re-enable, fails in AllTests
88
		// assertFalse(method.getInterest().isInteresting());
119
		// assertFalse(method.getInterest().isInteresting());
Lines 104-109 Link Here
104
135
105
		assertTrue(ContextCorePlugin.getContextManager()
136
		assertTrue(ContextCorePlugin.getContextManager()
106
				.manipulateInterestForElement(packageNode, false, false, false, "test"));
137
				.manipulateInterestForElement(packageNode, false, false, false, "test"));
138
		
139
		
140
		method = ContextCorePlugin.getContextManager().getElement(javaMethod.getHandleIdentifier());
141
		clazz = ContextCorePlugin.getContextManager().getElement(javaType.getHandleIdentifier());
142
		cu = ContextCorePlugin.getContextManager().getElement(javaCu.getHandleIdentifier());
143
144
		packageNode = ContextCorePlugin.getContextManager().getElement(
145
				javaPackage.getHandleIdentifier());
146
		
107
		assertFalse(packageNode.getInterest().isInteresting());
147
		assertFalse(packageNode.getInterest().isInteresting());
108
		assertFalse(cu.getInterest().isInteresting());
148
		assertFalse(cu.getInterest().isInteresting());
109
		assertFalse(clazz.getInterest().isInteresting());
149
		assertFalse(clazz.getInterest().isInteresting());
Lines 124-133 Link Here
124
		assertTrue(node.getInterest().isLandmark());
164
		assertTrue(node.getInterest().isLandmark());
125
		action.changeInterestForSelected(true);
165
		action.changeInterestForSelected(true);
126
166
127
		assertEquals((2 * scaling.getLandmark()) + scaling.get(InteractionEvent.Kind.SELECTION),
167
		assertEquals((scaling.getForcedLandmark()) + scaling.get(InteractionEvent.Kind.SELECTION),
128
				node.getInterest().getValue());
168
				node.getInterest().getValue());
129
169
130
		action.changeInterestForSelected(false);
170
		action.changeInterestForSelected(false);
171
		
172
		node = ContextCorePlugin.getContextManager().getElement(m1.getHandleIdentifier());
131
		assertFalse(node.getInterest().isLandmark());
173
		assertFalse(node.getInterest().isLandmark());
132
		assertTrue(node.getInterest().isInteresting());
174
		assertTrue(node.getInterest().isInteresting());
133
		action.changeInterestForSelected(false);
175
		action.changeInterestForSelected(false);
Lines 146-152 Link Here
146
188
147
		public void changeInterestForSelected(boolean increment) {
189
		public void changeInterestForSelected(boolean increment) {
148
			assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(
190
			assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(
149
					ContextCorePlugin.getContextManager().getActiveElement(), increment, false, false, ""));
191
					ContextCorePlugin.getContextManager().getActiveElement(), increment, false, true, ""));
150
		}
192
		}
151
	}
193
	}
152
}
194
}
(-)src/org/eclipse/mylyn/java/tests/AbstractJavaContextTest.java (+4 lines)
Lines 37-42 Link Here
37
	protected JavaEditingMonitor monitor = new JavaEditingMonitor();
37
	protected JavaEditingMonitor monitor = new JavaEditingMonitor();
38
38
39
	protected TestJavaProject project;
39
	protected TestJavaProject project;
40
	
41
	protected TestProject nonJavaProject;
40
42
41
	protected IPackageFragment p1;
43
	protected IPackageFragment p1;
42
44
Lines 54-59 Link Here
54
		assertNotNull(JavaPlugin.getDefault());
56
		assertNotNull(JavaPlugin.getDefault());
55
		assertNotNull(JavaUiBridgePlugin.getDefault());
57
		assertNotNull(JavaUiBridgePlugin.getDefault());
56
		project = new TestJavaProject(this.getClass().getSimpleName());
58
		project = new TestJavaProject(this.getClass().getSimpleName());
59
		nonJavaProject = new TestProject(this.getClass().getSimpleName() + "nonJava");
57
		p1 = project.createPackage("p1");
60
		p1 = project.createPackage("p1");
58
		type1 = project.createType(p1, "Type1.java", "public class Type1 { }");
61
		type1 = project.createType(p1, "Type1.java", "public class Type1 { }");
59
		context = new InteractionContext(contextId, scaling);
62
		context = new InteractionContext(contextId, scaling);
Lines 77-82 Link Here
77
		manager.getFileForContext(contextId).delete();
80
		manager.getFileForContext(contextId).delete();
78
81
79
		ResourceTestUtil.deleteProject(project.getProject());
82
		ResourceTestUtil.deleteProject(project.getProject());
83
		ResourceTestUtil.deleteProject(nonJavaProject.getProject());
80
84
81
		for (InteractionContext context : manager.getActiveContexts()) {
85
		for (InteractionContext context : manager.getActiveContexts()) {
82
			manager.deactivateContext(context.getHandleIdentifier());
86
			manager.deactivateContext(context.getHandleIdentifier());
(-)src/org/eclipse/mylyn/java/tests/TestProject.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
/*
9
 * Created on Jul 20, 2004
10
 */
11
package org.eclipse.mylyn.java.tests;
12
13
import java.lang.reflect.InvocationTargetException;
14
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IWorkspaceRoot;
17
import org.eclipse.core.resources.ResourcesPlugin;
18
import org.eclipse.core.runtime.CoreException;
19
20
/**
21
 * @author Shawn Minto
22
 */
23
public class TestProject {
24
	public IProject project;
25
26
	public TestProject(final String name) throws CoreException, InvocationTargetException, InterruptedException {
27
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
28
		project = root.getProject(name);
29
		project.create(null);
30
		project.open(null);
31
	}
32
33
	public IProject getProject() {
34
		return project;
35
	}
36
}

Return to bug 212285