Skip to content

Commit

Permalink
Merge branch 'eclipse-platform:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaJoeS authored Apr 12, 2024
2 parents 8d23737 + c5d730d commit 70e1bba
Show file tree
Hide file tree
Showing 24 changed files with 360 additions and 94 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.6</version>
<version>4.0.7</version>
</extension>
</extensions>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ public void testAllTabsAreInitializedByDefault() {
final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig);

for (ILaunchConfigurationTab tab : tabs) {
assertThat(((SpyTab) tab)).matches(SpyTab::isInitialized, "should have been initialized");
assertThat(((SpyTab) tab)).matches(SpyTab::isInitializedExactlyOnce, "should have been initialized exactly once");
}
}

@Test
public void testNoTabsAreDeactivatedByDefault() {
// Create a launch configuration with a unique name
ThrowingRunnable<CoreException> createAndSelect1LaunchConfig = () -> {
fLaunchConfigurationsDialog.getTabViewer().setInput(createLaunchConfigurationInstance());
};

final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig);

for (ILaunchConfigurationTab tab : tabs) {
assertThat(((SpyTab) tab)).matches(not(SpyTab::isDeactivated), "should NOT have been deactivated");
}
}

Expand All @@ -82,7 +96,29 @@ public void testFirstTabIsActivatedByDefault() {
};

final ILaunchConfigurationTab[] tabs = runOnDialog(createAndSelect1LaunchConfig);
assertThat(((SpyTab) tabs[0])).matches(SpyTab::isActivated, "should have been activated");
SpyTab defaultTab = (SpyTab) tabs[0];
assertThat(defaultTab).matches(SpyTab::isActivatedExactlyOnce, "should have been activated exactly once");
assertThat(defaultTab).matches(not(SpyTab::isDeactivated), "should NOT have been deactivated");
}

@Test
public void testActivatingTabTwiceDoesNotDeactivateIt() {
int tabIndex = 1;

// Create a launch configuration with a unique name
ThrowingRunnable<CoreException> selectTabTwice = () -> {
fLaunchConfigurationsDialog.getTabViewer().setInput(createLaunchConfigurationInstance());

// Activate the same tab twice
fLaunchConfigurationsDialog.getTabViewer().setActiveTab(tabIndex);
fLaunchConfigurationsDialog.getTabViewer().setActiveTab(tabIndex);
};

final ILaunchConfigurationTab[] tabs = runOnDialog(selectTabTwice);

SpyTab activeTab = (SpyTab) tabs[tabIndex];
assertThat(activeTab).matches(SpyTab::isActivatedExactlyOnce, "should have been activated exactly once");
assertThat(activeTab).matches(not(SpyTab::isDeactivated), "should NOT have been deactivated");
}

@Test
Expand All @@ -104,6 +140,12 @@ public void testOtherTabInOtherConfigIsActivated() {
final ILaunchConfigurationTab[] tabs = runOnDialog(setActiveTab);

assertThat(((SpyTab) tabs[0])).matches(not(SpyTab::isActivated), "should not have been activated");

// No tab should have been deactivated in the 2nd configuration
for (ILaunchConfigurationTab tab : tabs) {
assertThat(((SpyTab) tab)).matches(not(SpyTab::isDeactivated), "should not have been deactivated");
}

assertThat(((SpyTab) tabs[secondTabIndex])).matches(SpyTab::isActivated, "should have been activated");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
*/
public abstract class SpyTab extends AbstractLaunchConfigurationTab {

private boolean initialized;
private boolean activated;
private int initializedCount;
private int activatedCount;
private int deactivatedCount;

@Override
public String toString() {
return getClass().getSimpleName() + " [initialized=" + initialized + ", activated=" + activated + "]";
return getClass().getSimpleName() + " [initializedCount=" + initializedCount + ", activatedCount=" + activatedCount + ", deactivatedCount=" + deactivatedCount + "]";
}

@Override
Expand All @@ -41,12 +42,12 @@ public String getName() {

@Override
public void initializeFrom(ILaunchConfiguration configuration) {
initialized = true;
++initializedCount;
}

@Override
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
activated = true;
++activatedCount;
}

@Override
Expand All @@ -58,11 +59,27 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}

public boolean isInitialized() {
return initialized;
return initializedCount > 0;
}

public boolean isInitializedExactlyOnce() {
return initializedCount == 1;
}

public boolean isActivated() {
return activated;
return activatedCount > 0;
}

public boolean isActivatedExactlyOnce() {
return activatedCount == 1;
}

public boolean isDeactivated() {
return deactivatedCount > 0;
}

public boolean isDeactivatedExactlyOnce() {
return deactivatedCount == 1;
}

// These are necessary because I need several tabs in the launch config and
Expand Down
3 changes: 2 additions & 1 deletion platform/org.eclipse.platform/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ bin.includes = about.html,\
eclipse22.png,\
eclipse1024.png,\
org.eclipse.ui.intro.universal.solstice/,\
700E4F39BC05364B.asc
700E4F39BC05364B.asc,\
icons/
src.includes = about.html
source.platform.jar = src-intro/
output.platform.jar = bin-intro/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion platform/org.eclipse.platform/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
label="%cheatsheet.item"
class="org.eclipse.ui.cheatsheets.CheatSheetExtensionFactory:helpMenuAction"
menubarPath="help/group.tutorials"
id="org.eclipse.ui.cheatsheets.actions.CheatSheetHelpMenuAction">
id="org.eclipse.ui.cheatsheets.actions.CheatSheetHelpMenuAction"
icon="$nl$/icons/etool16/cheatsheet_view.png">
</action>
</actionSet>
</extension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,12 @@ private <T, J extends InternalJob> T withWriteLock(J job, Function<J, T> functio
* Returns a new progress monitor for this job. Never returns null.
*/
private IProgressMonitor createMonitor(Job job) {
if (progressProvider != null) {
return progressProvider.createMonitor(job);
}
return new NullProgressMonitor();
IProgressMonitor monitor = null;
if (progressProvider != null)
monitor = progressProvider.createMonitor(job);
if (monitor == null)
monitor = new NullProgressMonitor();
return monitor;
}

@Override
Expand Down
19 changes: 19 additions & 0 deletions team/bundles/org.eclipse.compare/.settings/.api_filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.compare" version="2">
<resource path="META-INF/MANIFEST.MF">
<filter comment="Changed contentMergeViewers extension point" id="926941240">
<message_arguments>
<message_argument value="3.11.0"/>
<message_argument value="3.10.0"/>
</message_arguments>
</filter>
</resource>
<resource path="compare/org/eclipse/compare/CompareConfiguration.java" type="org.eclipse.compare.CompareConfiguration">
<filter id="336658481">
<message_arguments>
<message_argument value="org.eclipse.compare.CompareConfiguration"/>
<message_argument value="CONTENT_TYPE"/>
</message_arguments>
</filter>
</resource>
</component>
2 changes: 1 addition & 1 deletion team/bundles/org.eclipse.compare/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.compare; singleton:=true
Bundle-Version: 3.10.100.qualifier
Bundle-Version: 3.11.0.qualifier
Bundle-Activator: org.eclipse.compare.internal.CompareUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public class CompareConfiguration {
*/
public static final String MIRRORED = "MIRRORED"; //$NON-NLS-1$

/**
* (Optional) id of the common content type for compare input detected by the
* compare editor
*
* @since 3.11
*/
public static final String CONTENT_TYPE = "CONTENT_TYPE"; //$NON-NLS-1$

private static ImageDescriptor[] fgImages= new ImageDescriptor[32];

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.text.MessageFormat;

import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
import org.eclipse.compare.contentmergeviewer.IFlushable;
import org.eclipse.compare.internal.CompareMessages;
import org.eclipse.compare.internal.IFlushable2;
Expand Down Expand Up @@ -279,9 +280,15 @@ public void setInput(Object input) {
if (fViewer != null) {
Control c= fViewer.getControl();
if (c != null) {
Object data= c.getData(CompareUI.COMPARE_VIEWER_TITLE);
if (data instanceof String)
title= (String) data;
if (fViewer instanceof ContentMergeViewer cmv) {
title = cmv.getTitle();
}
if (title == null || title.isBlank()) {
Object data = c.getData(CompareUI.COMPARE_VIEWER_TITLE);
if (data instanceof String) {
title = (String) data;
}
}
if (hadFocus)
c.setFocus();
}
Expand Down
Loading

0 comments on commit 70e1bba

Please sign in to comment.