Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.p2.ui,
org.eclipse.equinox.p2.ui.sdk,
org.springsource.ide.eclipse.commons.core,
org.eclipse.equinox.p2.engine
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.app,
org.eclipse.ui.ide.application,
org.objectweb.asm
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.core.runtime,
org.eclipse.osgi.service.datalocation,
org.osgi.framework
org.osgi.framework,
org.osgi.framework.hooks.weaving
Eclipse-BundleShape: dir
Export-Package: org.springframework.boot.ide.branding
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
output.. = bin/
source.. = src/
bin.includes = META-INF/,\
.,\
about.ini,\
about.properties,\
plugin.properties,\
Expand All @@ -15,5 +17,3 @@ bin.includes = META-INF/,\
about.html,\
sts4-16.png,\
trusted-keys/
output.library.jar = bin/
source.. = src/
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
<?eclipse version="3.2"?>
<plugin>

<extension
id="spring-tools-application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="org.springframework.boot.ide.branding.SpringToolsApplication">
</run>
</application>
</extension>

<extension id="sts4" point="org.eclipse.core.runtime.products">
<product name="%productName" application="org.eclipse.ui.ide.workbench" description="%productBlurb">
<product name="%productName" application="org.springframework.boot.ide.branding.spring-tools-application" description="%productBlurb">
<property name="windowImages" value="sts4-16.png,sts4-32.png,sts4-48.png"/>
<property name="aboutImage" value="sts_lg.gif"/>
<property name="aboutText" value="%productBlurb"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*******************************************************************************
* Copyright (c) 2025 Broadcom, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.boot.ide.branding;

import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.Version;
import org.osgi.framework.hooks.weaving.WeavingHook;
import org.osgi.framework.hooks.weaving.WovenClass;

/**
* Workaround for
* https://github.com/eclipse-platform/eclipse.platform.swt/pull/2694
*
* contributed by Sebastian Ratz
*/
@SuppressWarnings({ "nls" })
class MacOs26Dot1TextSelectionWorkaround implements WeavingHook {

@Override
public void weave(WovenClass wovenClass) {

if (!"org.eclipse.swt.graphics.TextLayout".equals(wovenClass.getClassName())) {
return;
}

try {
ClassReader cr = new ClassReader(wovenClass.getBytes());
ClassWriter cw = new ClassWriter(cr, 0);
ClassVisitor cv = new ClassVisitor(Opcodes.ASM9, cw) {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
if ("draw".equals(name)
&& "(Lorg/eclipse/swt/graphics/GC;IIIILorg/eclipse/swt/graphics/Color;Lorg/eclipse/swt/graphics/Color;I)V"
.equals(desc)) {
return new MethodVisitor(Opcodes.ASM9, mv) {
@Override
public void visitLdcInsn(Object value) {
if (value instanceof Double d && d.doubleValue() == 2.147483647E9d) { // 0x7fffffff
super.visitLdcInsn(0.5e7d); // OS.MAX_TEXT_CONTAINER_SIZE
} else {
super.visitLdcInsn(value);
}
}
};
}
return mv;
}
};
cr.accept(cv, 0);
wovenClass.setBytes(cw.toByteArray());
} catch (Throwable t) {
// Ignore for the moment
}
}

public static void installIfNecessary() {
if (!Platform.OS_MACOSX.equals(Platform.getOS())) {
return;
}
if (FrameworkUtil.getBundle(SWT.class).getVersion().compareTo(Version.parseVersion("3.132.0")) >= 0) {
return;
}
FrameworkUtil.getBundle(MacOs26Dot1TextSelectionWorkaround.class).getBundleContext().registerService(WeavingHook.class.getName(),
new MacOs26Dot1TextSelectionWorkaround(), null);
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2025 Broadcom, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.boot.ide.branding;

import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.ui.internal.ide.application.IDEApplication;

@SuppressWarnings("restriction")
public class SpringToolsApplication extends IDEApplication {

@Override
public Object start(IApplicationContext appContext) throws Exception {
MacOs26Dot1TextSelectionWorkaround.installIfNecessary();
return super.start(appContext);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="Spring Tools for Eclipse" id="org.springframework.boot.ide.branding.sts4" uid="org.springframework.boot.ide.branding.sts4" application="org.eclipse.ui.ide.workbench" version="4.32.2.qualifier" useFeatures="true" includeLaunchers="true">
<product name="Spring Tools for Eclipse" id="org.springframework.boot.ide.branding.sts4" uid="org.springframework.boot.ide.branding.sts4" application="org.springframework.boot.ide.branding.spring-tools-application" version="4.32.2.qualifier" useFeatures="true" includeLaunchers="true">

<configIni use="default">
</configIni>
Expand Down