Skip to content

Commit

Permalink
Merge branch 'master' into Enhancements/504_Show_differences_in_compa…
Browse files Browse the repository at this point in the history
…reEditor
  • Loading branch information
lathapatil authored Oct 16, 2023
2 parents c880f58 + cfb3c5f commit 69f2655
Show file tree
Hide file tree
Showing 35 changed files with 286 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<extension>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-build</artifactId>
<version>4.0.0</version>
<version>4.0.3</version>
</extension>
</extensions>
6 changes: 3 additions & 3 deletions debug/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.ui.launchview;singleton:=true
Bundle-Version: 1.1.200.qualifier
Bundle-Version: 1.1.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
Expand All @@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.e4.ui.di,
org.eclipse.e4.ui.services
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: javax.annotation;version="[1.0.0,2.0.0)",
javax.inject;version="[1.0.0,2.0.0)"
Import-Package: jakarta.annotation;version="[2.0.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml,
OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand Down Expand Up @@ -61,6 +57,10 @@
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Inject;

public class LaunchViewImpl implements Supplier<Set<ILaunchObject>> {

private static final String CONTEXT_MENU_ID = "LaunchViewContextMenu"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.filesystem,
org.eclipse.core.runtime,
org.eclipse.pde.junit.runtime;bundle-version="3.5.0"
Import-Package: org.mockito
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Eclipse-BundleShape: dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
Bug_029116.class, Bug_029671.class, Bug_029851.class, Bug_032076.class, Bug_044106.class, Bug_092108.class,
Bug_097608.class, Bug_098740.class, Bug_126104.class, Bug_127562.class, Bug_132510.class, Bug_134364.class,
Bug_147232.class, Bug_160251.class, Bug_165892.class, Bug_192631.class, Bug_226264.class, Bug_231301.class,
Bug_233939.class, Bug_265810.class, Bug_264182.class, Bug_288315.class, Bug_303517.class, Bug_329836.class,
Bug_331445.class, Bug_332543.class, Bug_378156.class, IFileTest.class, IFolderTest.class, IProjectTest.class,
Bug_233939.class, Bug_265810.class, Bug_264182.class, Bug_297635.class, Bug_288315.class, Bug_303517.class,
Bug_329836.class, Bug_331445.class, Bug_332543.class, Bug_378156.class,
IFileTest.class, IFolderTest.class, IProjectTest.class,
IResourceTest.class, IWorkspaceTest.class, LocalStoreRegressionTests.class, NLTest.class,
PR_1GEAB3C_Test.class,
PR_1GH2B0N_Test.class, PR_1GHOM0N_Test.class, Bug_530868.class, Bug_185247_recursiveLinks.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/*******************************************************************************
* Copyright (c) 2010, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Alexander Kurtakov <[email protected]> - Bug 459343
*******************************************************************************/
package org.eclipse.core.tests.resources.regression;

import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

import java.lang.reflect.Field;
import java.util.function.Consumer;
import org.eclipse.core.internal.resources.SaveManager;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.tests.harness.BundleTestingHelper;
import org.eclipse.core.tests.resources.ResourceTest;
import org.eclipse.core.tests.resources.content.ContentTypeTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;

/**
* Tests regression of bug 297635
*/
public class Bug_297635 extends ResourceTest {

@Override
protected void setUp() throws Exception {
super.setUp();
BundleWithSaveParticipant.install();
saveFull();
}

@Override
protected void tearDown() throws Exception {
try {
BundleWithSaveParticipant.uninstall();
} finally {
super.tearDown();
}
}

public void testCleanSaveStateBySaveParticipantOnSnapshotSave() throws Exception {
executeWithSaveManagerSpy(saveManagerSpy -> {
try {
saveSnapshot(saveManagerSpy);
} catch (CoreException e) {
}
verify(saveManagerSpy).forgetSavedTree(BundleWithSaveParticipant.getBundleName());
});
}

private void saveFull() throws CoreException {
getWorkspace().save(true, getMonitor());
}

private void saveSnapshot(SaveManager saveManager) throws CoreException {
saveManager.save(ISaveContext.SNAPSHOT, true, null, getMonitor());
}

private void executeWithSaveManagerSpy(Consumer<SaveManager> executeOnSpySaveManager) throws Exception {
IWorkspace workspace = getWorkspace();
String saveManagerFieldName = "saveManager";
SaveManager originalSaveManager = (SaveManager) getField(workspace, saveManagerFieldName);
SaveManager spySaveManager = spy(originalSaveManager);
try {
setField(workspace, saveManagerFieldName, spySaveManager);
executeOnSpySaveManager.accept(spySaveManager);
} finally {
setField(workspace, saveManagerFieldName, originalSaveManager);
}
}

private static Object getField(Object object, String fieldName) throws Exception {
Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(object);
}

private static void setField(Object object, String fieldName, Object value) throws Exception {
Field field = object.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(object, value);
}

private static final class BundleWithSaveParticipant {
private static String TEST_BUNDLE_LOCATION = "content/bundle01";

private static Bundle bundle;

private static ISaveParticipant saveParticipant = new ISaveParticipant() {
@Override
public void doneSaving(ISaveContext context) {
// nothing to do
}

@Override
public void prepareToSave(ISaveContext context) {
context.needDelta();
context.needSaveNumber();
}

@Override
public void rollback(ISaveContext context) {
// nothing to do
}

@Override
public void saving(ISaveContext context) {
// nothing to do
}
};

public static String getBundleName() {
if (bundle == null) {
throw new IllegalStateException("Bundle has not been installed");
}
return bundle.getSymbolicName();
}

public static void uninstall() throws BundleException {
if (bundle != null) {
bundle.uninstall();
}
}

public static void install() throws Exception {
bundle = BundleTestingHelper.installBundle("", getContext(),
ContentTypeTest.TEST_FILES_ROOT + TEST_BUNDLE_LOCATION);
BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { bundle });
bundle.start(Bundle.START_TRANSIENT);
registerSaveParticipant(bundle);
}

private static BundleContext getContext() {
return Platform.getBundle(PI_RESOURCES_TESTS).getBundleContext();
}

private static void registerSaveParticipant(Bundle saveParticipantsBundle) throws CoreException {
getWorkspace().addSaveParticipant(saveParticipantsBundle.getSymbolicName(), saveParticipant);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
TestBug12575.class, WorkspaceDescriptionTest.class, TestBug30015.class,
TestMasterTableCleanup.class,
ProjectPreferenceSessionTest.class, TestBug113943.class, TestCreateLinkedResourceInHiddenProject.class,
Bug_266907.class, TestBug297635.class, TestBug323833.class,
Bug_266907.class, TestBug323833.class,
org.eclipse.core.tests.resources.regression.TestMultipleBuildersOfSameType.class,
org.eclipse.core.tests.resources.usecase.SnapshotTest.class, ProjectDescriptionDynamicTest.class,
TestBug202384.class, TestBug369177.class, TestBug316182.class, TestBug294854.class, TestBug426263.class,
Expand Down
Loading

0 comments on commit 69f2655

Please sign in to comment.