diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a8f6396d..07334bb7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -7,7 +7,6 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] jobs: build: @@ -27,6 +26,13 @@ jobs: uses: stCarolas/setup-maven@v4.5 with: maven-version: '3.9.7' + - name: Start Xvfb + run: | + sudo apt-get update + sudo apt-get install -y xvfb + Xvfb :99 -screen 0 1920x1080x24 & + export DISPLAY=:99 + echo "DISPLAY=:99" >> $GITHUB_ENV - name: Build with Maven run: mvn clean verify -ntp - uses: "marvinpinto/action-automatic-releases@latest" diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 7cb2ea01..7c08e987 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -2,6 +2,6 @@ org.eclipse.tycho tycho-build - 4.0.12 + 4.0.13 \ No newline at end of file diff --git a/README.adoc b/README.adoc index 514fe090..d1133cc2 100644 --- a/README.adoc +++ b/README.adoc @@ -2,6 +2,10 @@ This is the example code for the https://learn.vogella.com/courses/details/rich-client-platform[Eclipse RCP commercial training] from vogella GmbH. It is also used in the http://www.vogella.com/books/eclipsercp.html[Eclipse Rich Client Platform book]. +=== Default branch + +_main_ is the default branch of this repository. +It contains the latest stable version of the code. === Running the application diff --git a/com.example.e4.swtbot.tests/.classpath b/com.example.e4.swtbot.tests/.classpath new file mode 100644 index 00000000..375961e4 --- /dev/null +++ b/com.example.e4.swtbot.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/com.example.e4.swtbot.tests/.project b/com.example.e4.swtbot.tests/.project new file mode 100644 index 00000000..93d71d5e --- /dev/null +++ b/com.example.e4.swtbot.tests/.project @@ -0,0 +1,45 @@ + + + com.example.e4.swtbot.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + 1749802401051 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/com.example.e4.swtbot.tests/.settings/org.eclipse.core.resources.prefs b/com.example.e4.swtbot.tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/com.example.e4.swtbot.tests/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/com.example.e4.swtbot.tests/.settings/org.eclipse.jdt.core.prefs b/com.example.e4.swtbot.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..23fa13b1 --- /dev/null +++ b/com.example.e4.swtbot.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=21 diff --git a/com.example.e4.swtbot.tests/.settings/org.eclipse.m2e.core.prefs b/com.example.e4.swtbot.tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/com.example.e4.swtbot.tests/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/com.example.e4.swtbot.tests/META-INF/MANIFEST.MF b/com.example.e4.swtbot.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000..1ed32a33 --- /dev/null +++ b/com.example.e4.swtbot.tests/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Swtbottests +Bundle-SymbolicName: com.example.e4.swtbot.tests +Bundle-Version: 1.0.0.qualifier +Import-Package: org.junit.jupiter.api;version="5.12.2" +Bundle-Vendor: EXAMPLE +Require-Bundle: org.eclipse.swt, + org.eclipse.jface, + org.eclipse.swtbot.e4.finder;bundle-version="4.3.0", + org.eclipse.swtbot.swt.finder;bundle-version="4.3.0", + org.slf4j.api;bundle-version="1.7.30", + com.example.e4.rcp;bundle-version="1.0.0" +Automatic-Module-Name: com.example.e4.swtbottests +Bundle-RequiredExecutionEnvironment: JavaSE-21 diff --git a/com.example.e4.swtbot.tests/build.properties b/com.example.e4.swtbot.tests/build.properties new file mode 100644 index 00000000..6fd464a8 --- /dev/null +++ b/com.example.e4.swtbot.tests/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +pom.model.property.tycho.surefire.useUIHarness = true +pom.model.property.tycho.surefire.useUIThread = true \ No newline at end of file diff --git a/com.example.e4.swtbot.tests/src/com/example/e4/swtbottests/ExitHandlerTest.java b/com.example.e4.swtbot.tests/src/com/example/e4/swtbottests/ExitHandlerTest.java new file mode 100644 index 00000000..9d52a482 --- /dev/null +++ b/com.example.e4.swtbot.tests/src/com/example/e4/swtbottests/ExitHandlerTest.java @@ -0,0 +1,45 @@ +package com.example.e4.swtbottests; + + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ExitHandlerTest { + + private static SWTBot bot; + + @BeforeEach + public void beforeClass() throws Exception { + // don't use SWTWorkbenchBot here which relies on Platform 3.x + bot = new SWTBot(); + } + + @Test + public void executeExit() { + SWTBotMenu fileMenu = bot.menu("File"); + assertNotNull(fileMenu); + SWTBotMenu exitMenu = fileMenu.menu("Quit"); + assertNotNull(exitMenu); + exitMenu.click(); + + SWTBotShell shell = bot.shell("Confirmation"); + SWTBot childBot = new SWTBot(shell.widget); + SWTBotButton button = childBot.button("Cancel"); + assertTrue(button.isEnabled()); + button.click(); + } + + + +// @AfterEach +// public void sleep() { +// bot.sleep(2000); +// } +} diff --git a/com.vogella.eclipse.css/css/dark.css b/com.vogella.eclipse.css/css/dark.css new file mode 100644 index 00000000..82173363 --- /dev/null +++ b/com.vogella.eclipse.css/css/dark.css @@ -0,0 +1,68 @@ +#org-eclipse-ui-editorss { + swt-tab-height: 8px; +} + +.MPartStack { + font-family: 'Segoe UI', sans-serif; +} + +CTabFolder { + color: #bbbbbb; /* Inactive tab text */ + swt-tab-outline: #2a2a2a; /* Border color for selected tab */ + swt-outer-keyline-color: #3a3a3a; /* Border color for the tabs container */ + swt-unselected-tabs-color: #2e2e2e #252525 100% 100%; /* Background for unselected tabs */ + swt-selected-tab-fill: #3d3d3d; /* Background for selected tab */ + swt-unselected-hot-tab-color-background: #161616; /* Hovered tab background */ + swt-selected-tab-highlight: none; +} + +CTabFolder[style~='SWT.DOWN'][style~='SWT.BOTTOM'] { + swt-unselected-hot-tab-color-background: #161616; + swt-selected-tab-highlight: #316c9b; + swt-selected-highlight-top: false; +} + +CTabFolder.active { + swt-selected-tab-highlight: #316c9b; + swt-selected-highlight-top: false; +} + +CTabItem, +CTabItem CLabel { + background-color: #3d3d3d; + color: #999999; /* Inactive, unselected tab text */ +} + +CTabItem:selected, +CTabItem:selected CLabel { + color: #ffffff; /* Selected tab text */ +} + +.MPartStack.active > CTabItem, +.MPartStack.active > CTabItem CLabel { + background-color: #3d3d3d; + color: #cccccc; /* Active, unselected tab text */ +} + +.MPartStack.active > CTabItem:selected, +.MPartStack.active > CTabItem:selected CLabel { + color: #ffffff; /* Active, selected tab text */ +} + +.MPartStack.active.noFocus > CTabItem:selected { + color: #aaaaaa; /* Selected but no focus */ +} + +CTabFolder > Composite#ToolbarComposite { + background-color: #3d3d3d; +} + +CTabFolder.MArea CTabItem, +CTabFolder.MArea CTabItem CLabel { + background-color: #1e1e1e; /* Dark background fallback */ +} + +CTabItem.busy { + color: #888888; +} + diff --git a/com.vogella.eclipse.css/plugin.xml b/com.vogella.eclipse.css/plugin.xml index 33f15f35..43221efe 100644 --- a/com.vogella.eclipse.css/plugin.xml +++ b/com.vogella.eclipse.css/plugin.xml @@ -13,6 +13,11 @@ id="com.vogella.eclipse.css.rainbow" label="Rainbow"> + + diff --git a/com.vogella.swt.widgets/image/vogella.svg b/com.vogella.swt.widgets/image/vogella.svg new file mode 100644 index 00000000..94bef741 --- /dev/null +++ b/com.vogella.swt.widgets/image/vogella.svg @@ -0,0 +1,1976 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.vogella.swt.widgets/src/com/vogella/swt/widgets/ImageWithText.java b/com.vogella.swt.widgets/src/com/vogella/swt/widgets/ImageWithText.java new file mode 100644 index 00000000..55c3da14 --- /dev/null +++ b/com.vogella.swt.widgets/src/com/vogella/swt/widgets/ImageWithText.java @@ -0,0 +1,51 @@ +package com.vogella.swt.widgets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ImageWithText extends Canvas { + + private Image image; + + public ImageWithText(Composite parent, int style) { + super(parent, style); + Display display = parent.getDisplay(); + image = new Image(parent.getDisplay(), ImageWithText.class.getResourceAsStream("/image/vogella.svg")); + + // Add PaintListener to draw image and text + this.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + Rectangle bounds = image.getBounds(); + e.gc.drawImage(image, 0, 0); + + // Set text properties + e.gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); + e.gc.setFont(display.getSystemFont()); + + String text = "Advanced Trainings"; + Point textSize = e.gc.textExtent(text); + + // Draw text centered at the top of the image + int x = (bounds.width - textSize.x) / 2; + int y = 20; + + e.gc.drawText(text, x, y, true); + } + }); + + + } + @Override + public void dispose() { + image.dispose(); + super.dispose(); + } +} diff --git a/com.vogella.tasks.product/taskmanagement.product b/com.vogella.tasks.product/taskmanagement.product index 57d123c9..c64e535f 100644 --- a/com.vogella.tasks.product/taskmanagement.product +++ b/com.vogella.tasks.product/taskmanagement.product @@ -34,8 +34,6 @@ - - diff --git a/com.vogella.tasks.ui/Application.e4xmi b/com.vogella.tasks.ui/Application.e4xmi index d28eed54..f42aba80 100644 --- a/com.vogella.tasks.ui/Application.e4xmi +++ b/com.vogella.tasks.ui/Application.e4xmi @@ -1,29 +1,26 @@ - + NoAutoCollapse - + - - - - + - + @@ -54,6 +51,15 @@ + + + + + + + + + diff --git a/com.vogella.tasks.ui/META-INF/MANIFEST.MF b/com.vogella.tasks.ui/META-INF/MANIFEST.MF index ef456d45..6e9c2c98 100644 --- a/com.vogella.tasks.ui/META-INF/MANIFEST.MF +++ b/com.vogella.tasks.ui/META-INF/MANIFEST.MF @@ -27,5 +27,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-21 Automatic-Module-Name: com.vogella.tasks.ui Import-Package: com.vogella.swt.widgets, jakarta.annotation, - jakarta.inject + jakarta.inject;version="[2.0.0,3.0.0)" Require-Capability: osgi.service;filter:="(objectClass=com.vogella.tasks.model.TaskService)" diff --git a/com.vogella.tasks.ui/build.properties b/com.vogella.tasks.ui/build.properties index 19b960b8..0fabeedf 100644 --- a/com.vogella.tasks.ui/build.properties +++ b/com.vogella.tasks.ui/build.properties @@ -2,5 +2,6 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - Application.e4xmi + Application.e4xmi,\ + images/ source.. = src/ diff --git a/com.vogella.tasks.ui/images/playground.svg b/com.vogella.tasks.ui/images/playground.svg new file mode 100644 index 00000000..11bea1d1 --- /dev/null +++ b/com.vogella.tasks.ui/images/playground.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/com.vogella.tasks.ui/images/task-detail.svg b/com.vogella.tasks.ui/images/task-detail.svg new file mode 100644 index 00000000..48f26275 --- /dev/null +++ b/com.vogella.tasks.ui/images/task-detail.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/com.vogella.tasks.ui/images/task-overview.svg b/com.vogella.tasks.ui/images/task-overview.svg new file mode 100644 index 00000000..ae8ae68f --- /dev/null +++ b/com.vogella.tasks.ui/images/task-overview.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/com.vogella.tasks.ui/plugin.xml b/com.vogella.tasks.ui/plugin.xml index f1b683c0..7aada3ca 100644 --- a/com.vogella.tasks.ui/plugin.xml +++ b/com.vogella.tasks.ui/plugin.xml @@ -10,13 +10,29 @@ application="org.eclipse.e4.ui.workbench.swt.E4Application"> + value="to-do"> + value="com.vogella.eclipse.css.dark"> + + + + + + + + + + diff --git a/com.vogella.tasks.ui/src/com/vogella/tasks/ui/expressions/CheckSelection.java b/com.vogella.tasks.ui/src/com/vogella/tasks/ui/expressions/CheckSelection.java new file mode 100644 index 00000000..fac84e04 --- /dev/null +++ b/com.vogella.tasks.ui/src/com/vogella/tasks/ui/expressions/CheckSelection.java @@ -0,0 +1,27 @@ +package com.vogella.tasks.ui.expressions; + +import org.eclipse.e4.core.di.annotations.Evaluate; +import org.eclipse.e4.core.di.annotations.Optional; + +import com.vogella.tasks.model.Task; + +import jakarta.inject.Named; + +import java.util.Collection; + +public class CheckSelection { + @Evaluate + public boolean evaluate(@Optional @Named("org.eclipse.ui.selection") Object o) { + if (o instanceof Task) { + return true; + } + if (o instanceof Collection) { + for (Object item : (Collection) o) { + if (item instanceof Task) { + return true; + } + } + } + return false; + } +} diff --git a/pom.xml b/pom.xml index 10bc8a8c..428a7c1c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom - 4.0.12 + 4.0.13 UTF-8 @@ -85,17 +85,28 @@ + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho.version} + + org.eclipse.e4.ui.workbench.swt.E4Application + com.example.e4.rcp.product + + + - com.example.e4.rcp com.example.e4.feature - com.example.e4.product - --> + + com.example.e4.product com.vogella.swt.widgets com.vogella.tasks.ui com.example.e4.renderer.swt @@ -110,9 +121,8 @@ com.vogella.eclipse.css com.vogella.osgi.taskconsumer updatesite - \ No newline at end of file diff --git a/target-platform/target-platform.target b/target-platform/target-platform.target index 2dec207b..eb2c2e2e 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target @@ -3,7 +3,7 @@ - + @@ -11,10 +11,23 @@ + + + + + + + +