Skip to content

Commit 3304568

Browse files
committed
Merge branch 'release/2.6'
2 parents 1688c7e + 47d4838 commit 3304568

File tree

10 files changed

+100
-60
lines changed

10 files changed

+100
-60
lines changed

core/org.eclipse.rcptt.core/src/org/eclipse/rcptt/core/persistence/PersistenceManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,4 +521,13 @@ public IPersistenceModel getModel(byte[] content, Resource res) {
521521
}
522522
return null;
523523
}
524+
525+
public int cachedSize(Resource res) {
526+
IFile file = WorkspaceSynchronizer.getFile(res);
527+
if (!file.exists() || !file.isSynchronized(IResource.DEPTH_INFINITE)) {
528+
return 0;
529+
}
530+
File fs = file.getLocation().toFile();
531+
return (int) Math.min(fs.length(), Integer.MAX_VALUE);
532+
}
524533
}

core/org.eclipse.rcptt.core/src/org/eclipse/rcptt/core/workspace/RcpttCore.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ public List<String> getContextReferences(IContext context) {
283283
try {
284284
NamedElement namedElement = context.getNamedElement();
285285
if (namedElement instanceof GroupContext) {
286-
return ((GroupContext) namedElement).getContextReferences();
286+
return copy(((GroupContext) namedElement).getContextReferences());
287287
} else if (namedElement instanceof SuperContext) {
288-
return ((SuperContext) namedElement).getContextReferences();
288+
return copy(((SuperContext) namedElement).getContextReferences());
289289
} else if (namedElement instanceof CapabilityContext) {
290290
final CapabilityContext ccontext = (CapabilityContext) namedElement;
291291
final Set<String> result = new LinkedHashSet<String>();
@@ -529,6 +529,9 @@ public IVerification[] getVerifications(IQ7NamedElement element, List<String> ve
529529

530530
public IContext findContext(IQ7NamedElement element, boolean ignoreErrors,
531531
String contextId, IWorkspaceFinder finder) {
532+
if (finder == null) {
533+
finder = WorkspaceFinder.getInstance();
534+
}
532535
IContext[] context = finder.findContext(element, contextId);
533536
IContext result = null;
534537
if (context != null && context.length > 0) {
@@ -911,4 +914,8 @@ public static String getResourcePath(String id) {
911914
}
912915
return element.getResource().getFullPath().toString();
913916
}
917+
918+
private static <T> List<T> copy(List<T> input) {
919+
return new ArrayList<>(input);
920+
}
914921
}

core/org.eclipse.rcptt.core/src/org/eclipse/rcptt/internal/core/model/Q7ResourceInfo.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
import org.eclipse.rcptt.core.persistence.plain.PlainTextPersistenceModel;
2626
import org.eclipse.rcptt.core.scenario.NamedElement;
2727
import org.eclipse.rcptt.internal.core.Q7LazyResource;
28+
import org.eclipse.rcptt.internal.core.model.cache.ILRUCacheable;
2829

29-
public class Q7ResourceInfo extends OpenableElementInfo {
30+
public class Q7ResourceInfo extends OpenableElementInfo implements ILRUCacheable {
3031
private final Resource resource;
3132
private NamedElement element;
3233
public long timestamp;
@@ -153,4 +154,14 @@ public Resource getResource() {
153154
public void updatePersistenceModel(IPersistenceModel newModel) {
154155
PersistenceManager.getInstance().replaceModelWith(resource, newModel);
155156
}
157+
158+
@Override
159+
public int getCacheFootprint() {
160+
Resource res = getResource();
161+
if (res == null) {
162+
return 0;
163+
}
164+
165+
return PersistenceManager.getInstance().cachedSize(res);
166+
}
156167
}

core/org.eclipse.rcptt.core/src/org/eclipse/rcptt/internal/core/model/cache/ModelCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ModelCache {
2323

2424
// public static final int DEFAULT_PKG_SIZE = 500; // average 1782 bytes per
2525

26-
public static final int DEFAULT_OPENABLE_SIZE = 100; // average 6629
26+
public static final int DEFAULT_OPENABLE_SIZE = 10000; // average 6629
2727

2828
public static final int DEFAULT_CHILDREN_SIZE = 100 * 20; // average 20
2929

devenv/launches/RCPTT IDE.launch

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<setEntry value="bcpg@default:default"/>
3535
<setEntry value="bcprov@default:default"/>
3636
<setEntry value="com.google.gson@default:default"/>
37-
<setEntry value="com.google.guava*33.4.6.jre@default:default"/>
3837
<setEntry value="com.google.guava.failureaccess@default:default"/>
38+
<setEntry value="com.google.guava@default:default"/>
3939
<setEntry value="com.ibm.icu@default:default"/>
4040
<setEntry value="com.jcraft.jsch@default:default"/>
4141
<setEntry value="com.sun.jna.platform@default:default"/>
@@ -500,7 +500,6 @@
500500
<setEntry value="org.eclipse.rcptt.tesla.recording.core.ecl@default:default"/>
501501
<setEntry value="org.eclipse.rcptt.tesla.recording.core@default:default"/>
502502
<setEntry value="org.eclipse.rcptt.tesla.swt.fragment@default:false"/>
503-
<setEntry value="org.eclipse.rcptt.ui.activities@default:default"/>
504503
<setEntry value="org.eclipse.rcptt.ui.report@default:default"/>
505504
<setEntry value="org.eclipse.rcptt.ui@default:default"/>
506505
<setEntry value="org.eclipse.rcptt.updates.aspectj.e44x@default:default"/>

launching/org.eclipse.rcptt.launching.ext/src/org/eclipse/rcptt/launching/ext/BundleStart.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ public static BundleStart fromModelString(String str) {
141141
}
142142

143143
public static BundleStart fromBundle(BundleInfo info) {
144-
return new BundleStart(info.getStartLevel(), info.isMarkedAsStarted(),
144+
return internDefault(new BundleStart(info.getStartLevel(), info.isMarkedAsStarted(),
145145
info.getStartLevel() == BundleInfo.NO_LEVEL,
146-
!info.isMarkedAsStarted());
146+
!info.isMarkedAsStarted()));
147147
}
148148

149149
public final int level;
@@ -160,4 +160,7 @@ public static BundleStart fromQ7Headers(String q7sl, String q7as) {
160160
MoreObjects.firstNonNull(q7sl, DEF_STR),
161161
MoreObjects.firstNonNull(q7as, DEF_STR)));
162162
}
163+
private static BundleStart internDefault(BundleStart info) {
164+
return info.isDefault() ? DEFAULT : info;
165+
}
163166
}

launching/org.eclipse.rcptt.launching.ext/src/org/eclipse/rcptt/launching/ext/Q7ExternalLaunchDelegate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ protected void preLaunchCheck(final ILaunchConfiguration configuration,
636636

637637
setBundlesToLaunch(info, bundlesToLaunch);
638638

639-
checkBundles(bundlesToLaunch);
639+
removeUnresolved(bundlesToLaunch);
640640
setDelegateFields(this, bundlesToLaunch.fModels, Maps.transformValues(bundlesToLaunch.fAllBundles.asMap(), ArrayList::new));
641641

642642
// Copy all additional configuration area folders into PDE new
@@ -645,7 +645,7 @@ protected void preLaunchCheck(final ILaunchConfiguration configuration,
645645
monitor.done();
646646
}
647647

648-
private void checkBundles(BundlesToLaunch launch) {
648+
public static void removeUnresolved(BundlesToLaunch launch) {
649649
DependencyResolver resolver = new DependencyResolver(launch.fAllBundles);
650650
Collection<IPluginModelBase> toDelete = resolver.checkPlugins(launch.fModels.keySet());
651651
toDelete.forEach(plugin->{

launching/org.eclipse.rcptt.launching.ext/src/org/eclipse/rcptt/launching/internal/target/TargetPlatformHelper.java

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import static java.lang.String.format;
1515
import static java.util.Arrays.stream;
1616
import static java.util.Collections.emptyList;
17+
import static java.util.function.Predicate.not;
1718
import static org.eclipse.core.runtime.IProgressMonitor.done;
1819
import static org.eclipse.rcptt.internal.launching.ext.Q7ExtLaunchingPlugin.PLUGIN_ID;
1920

@@ -110,6 +111,7 @@
110111
import org.osgi.framework.BundleException;
111112
import org.osgi.framework.Version;
112113

114+
import com.google.common.base.Joiner;
113115
import com.google.common.base.Objects;
114116
import com.google.common.base.Preconditions;
115117
import com.google.common.collect.HashMultimap;
@@ -517,6 +519,7 @@ public IStatus resolve(IProgressMonitor monitor) {
517519

518520
private void index() {
519521
stream(target.getBundles()).forEach(bundle -> targetBundleIndex.put(bundle.getBundleInfo().getSymbolicName(), bundle));
522+
targetBundleIndex.removeAll(null);
520523
}
521524

522525
private void resetIndex() {
@@ -1059,38 +1062,40 @@ public String getTemplateConfigLocation() {
10591062
public OSArchitecture detectArchitecture(
10601063
boolean preferCurrentVmArchitecture, StringBuilder detectMsg) {
10611064
checkResolved();
1065+
String architecture = target.getArch();
1066+
if (architecture != null) {
1067+
return OSArchitecture.valueOf(architecture);
1068+
}
1069+
10621070
String os = Platform.getOS();
1063-
TargetBundle[] bundles = target.getAllBundles();
1064-
for (TargetBundle b : bundles) {
1065-
BundleInfo info = b.getBundleInfo();
1066-
String name = info.getSymbolicName();
1067-
if (name != null && name.startsWith("org.eclipse.equinox.launcher")) {
1068-
if (!name.contains(os)) {
1069-
continue;
1070-
}
1071-
URI location = info.getLocation();
1072-
if (location == null || location.getPath() == null) {
1073-
continue;
1074-
}
1075-
1076-
if (name.contains("aarch64")) {
1077-
if (detectMsg != null) {
1078-
detectMsg.append("aarch64 arch is selected because AUT uses " + name);
1079-
}
1080-
return OSArchitecture.aarch64;
1081-
} else if (name.contains("x86_64")) {
1082-
if (detectMsg != null) {
1083-
detectMsg.append("x86_64 arch is selected because AUT uses " + name);
1084-
}
1085-
return OSArchitecture.x86_64;
1086-
} else if (name.contains("x86")) {
1087-
if (detectMsg != null) {
1088-
detectMsg.append("x86 arch is selected because AUT uses " + name);
1089-
}
1090-
return OSArchitecture.x86;
1091-
1092-
}
1071+
Set<String> launcherLibraries = targetBundleIndex.keySet().stream().filter(name -> name.startsWith("org.eclipse.equinox.launcher") && name.contains(os)).collect(Collectors.toSet());
1072+
if (launcherLibraries.size() != 1) {
1073+
if (detectMsg != null) {
1074+
detectMsg.append("Multiple launcher libraries are found in target platform: " + Joiner.on(", ").join(launcherLibraries));
10931075
}
1076+
return OSArchitecture.Unknown;
1077+
}
1078+
1079+
String name = launcherLibraries.iterator().next();
1080+
if (name.contains("aarch64")) {
1081+
if (detectMsg != null) {
1082+
detectMsg.append("aarch64 arch is selected because AUT uses " + name);
1083+
}
1084+
return OSArchitecture.aarch64;
1085+
} else if (name.contains("x86_64")) {
1086+
if (detectMsg != null) {
1087+
detectMsg.append("x86_64 arch is selected because AUT uses " + name);
1088+
}
1089+
return OSArchitecture.x86_64;
1090+
} else if (name.contains("x86")) {
1091+
if (detectMsg != null) {
1092+
detectMsg.append("x86 arch is selected because AUT uses " + name);
1093+
}
1094+
return OSArchitecture.x86;
1095+
}
1096+
1097+
if (detectMsg != null) {
1098+
detectMsg.append("Unrecognized launcher architecture: " + name);
10941099
}
10951100

10961101
return OSArchitecture.Unknown;
@@ -1239,8 +1244,7 @@ public String toString() {
12391244

12401245
@Override
12411246
public Map<String, org.eclipse.equinox.p2.metadata.Version> getVersions() throws CoreException {
1242-
if (!getStatus().isOK())
1243-
throw new CoreException(getStatus());
1247+
checkResolved();
12441248
return AUTInformation.getInformationMap(target);
12451249
}
12461250

@@ -1706,30 +1710,33 @@ private static void debug(String message) {
17061710
}
17071711
private void setStartLevels(SubMonitor monitor) throws IOException, BundleException {
17081712
Map<String, BundleStart> levelMap = getRunlevelsMap();
1709-
1710-
if (levelMap.isEmpty()) {
1711-
warning("No start levels are configured");
1712-
}
17131713
if (!target.isResolved()) {
17141714
throw new IllegalStateException("Target definition is unresolved");
17151715
}
1716-
1716+
17171717
TargetBundle[] bundles = target.getBundles();
17181718
monitor.beginTask("Setting bundle start levels", bundles.length);
17191719
for (TargetBundle bundle : bundles) {
1720-
monitor.subTask(bundle.getBundleInfo().getLocation().toString());
1721-
BundleStart bundleLevel = levelMap.getOrDefault(bundle.getBundleInfo().getSymbolicName(), BundleStart.DEFAULT);
1722-
bundleLevel = StartLevelSupport.getStartInfo(bundle.getBundleInfo().getManifest(), bundleLevel);
1720+
BundleInfo bundleInfo = bundle.getBundleInfo();
1721+
monitor.subTask(bundleInfo.getLocation().toString());
1722+
BundleStart bundleLevel = levelMap.getOrDefault(bundleInfo.getSymbolicName(), BundleStart.DEFAULT);
1723+
bundleLevel = StartLevelSupport.getStartInfo(bundleInfo.getManifest(), bundleLevel);
17231724
monitor.split(1);
1724-
if (bundleLevel != null) {
1725-
try {
1726-
bundle.getBundleInfo().setStartLevel(bundleLevel.level);
1727-
bundle.getBundleInfo().setMarkedAsStarted(bundleLevel.autoStart);
1728-
} catch (RuntimeException e) {
1729-
throw new IllegalStateException(format("Invalid run level descriptor for bundle %s : %s ", bundle.getBundleInfo().getSymbolicName(), bundleLevel), e);
1730-
}
1725+
if (bundleLevel.isDefault()) {
1726+
continue;
1727+
}
1728+
try {
1729+
bundleInfo.setStartLevel(bundleLevel.level);
1730+
bundleInfo.setMarkedAsStarted(bundleLevel.autoStart);
1731+
} catch (RuntimeException e) {
1732+
throw new IllegalStateException(format("Invalid run level descriptor for bundle %s : %s ", bundleInfo.getSymbolicName(), bundleLevel), e);
17311733
}
17321734
}
1735+
if (!stream(bundles).map(TargetBundle::getBundleInfo).map(BundleStart::fromBundle).anyMatch(not(BundleStart::isDefault))) {
1736+
// this happens only if target platform has no bundles from org.eclipse.rcptt.launching.ext.StartLevelSupport.predefined
1737+
warning("No start levels are configured");
1738+
}
1739+
17331740
}
17341741

17351742
private void warning(String message) {

rcp/org.eclipse.rcptt.launching.configuration/src/org/eclipse/rcptt/launching/configuration/Q7LaunchConfigurationDelegate.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ public String[] getProgramArguments(ILaunchConfiguration configuration)
235235
new FileOutputStream(config))) {
236236
props.store(out, "Configuration File");
237237
}
238+
// Workaround for https://github.com/eclipse-oomph/oomph/issues/152
239+
// Create a configured directory so that Oomph can ensure it is writable and use it and not fall back to default
240+
new File(config.getParent(), ".p2").mkdirs();
238241
} catch (IOException e) {
239242
throw new CoreException(Q7ExtLaunchingPlugin.status(e));
240243
}
@@ -282,6 +285,7 @@ protected void preLaunchCheck(final ILaunchConfiguration configuration,
282285

283286
Q7ExternalLaunchDelegate.BundlesToLaunch bundles = collector.getResult();
284287

288+
Q7ExternalLaunchDelegate.removeUnresolved(bundles);
285289
Q7ExternalLaunchDelegate.setBundlesToLaunch(info, bundles);
286290

287291
Q7LaunchDelegateUtils.setDelegateFields(this, bundles.fModels, Maps.transformValues(bundles.fAllBundles.asMap(), ArrayList::new));

rcpttTests/contexts/procedures.ctx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Element-Name: procedures
55
Element-Type: context
66
Element-Version: 2.0
77
Id: _tqDkkAJnEfCi5Lv1yRTTlg
8-
Runtime-Version: 2.5.5.202404041628
9-
Save-Time: 3/26/25, 12:57 AM
8+
Runtime-Version: 2.6.0.202504111505
9+
Save-Time: 5/7/25, 8:07 PM
1010

1111
------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
1212
Content-Type: text/plain
@@ -32,7 +32,7 @@ proc replace_all [val input -input] [val pattern] [val replacement] {
3232
with [$input] {
3333
get-text-viewer | key-type "M1+f"
3434
try -command {
35-
get-button "Search all.*"
35+
get-button "Close.*"
3636
} -times 10 -delay 2000
3737
with [get-editbox -after [get-button "Toggle input for replace.*"]] {
3838
set-text $pattern

0 commit comments

Comments
 (0)