Skip to content

Commit

Permalink
devonfw#1519 Fixed Eclipse Plugin Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansour Dukhan committed Jun 9, 2022
1 parent 391597d commit 9d4ca8b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;

/**
* JUnit Rule for a temporary {@link IJavaProject}. Should be created in each test method by createProject when it
* should be used.
Expand All @@ -37,7 +39,7 @@ public class TmpJavaProjectRule extends ExternalResource {
private IJavaProject javaProject;

@Override
protected void after() {
protected void after() throws CobiGenRuntimeException {

try {
if (this.javaProject != null && this.javaProject.getProject() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;

/**
* JUnit Rule for a temporary {@link IJavaProject}. Should be created in each test method by createProject when it
* should be used.
Expand All @@ -39,7 +41,7 @@ public class TmpMavenProjectRule extends ExternalResource {
private String mvnProjectSpecification;

@Override
protected void after() {
protected void after() throws CobiGenRuntimeException {

try {
if (this.javaProject != null && this.javaProject.getProject() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;

/**
* Checks whether any shell with one of the given dialog titles is displayed and having focus.
*/
Expand Down Expand Up @@ -34,7 +36,7 @@ public String getFailureMessage() {
}

@Override
public boolean test() throws Exception {
public boolean test() throws Exception, CobiGenRuntimeException {

for (String title : this.titles) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
import com.devonfw.cobigen.eclipse.test.common.swtbot.AllJobsAreFinished;
import com.devonfw.cobigen.eclipse.test.common.utils.swtbot.SwtBotProjectActions;
Expand Down Expand Up @@ -204,7 +205,7 @@ public static void cleanWorkspace(SWTWorkbenchBot bot, boolean cleanCobiGenConfi
*
* @param bot the current workbench bot
*/
public static void openErrorsTreeInProblemsView(SWTWorkbenchBot bot) {
public static void openErrorsTreeInProblemsView(SWTWorkbenchBot bot) throws CobiGenRuntimeException {

try {
SWTBotView viewByTitle = bot.view(withTitle(containsString("Problems")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.hamcrest.Matcher;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.google.common.collect.Iterables;

/**
Expand Down Expand Up @@ -221,7 +222,8 @@ public String getFailureMessage() {
}

/** Wait until a menu contains a matching item. */
public static void waitUntilMenuHasItem(SWTBot bot, Supplier<SWTBotMenu> menuSupplier, Matcher<String> matcher) {
public static void waitUntilMenuHasItem(SWTBot bot, Supplier<SWTBotMenu> menuSupplier, Matcher<String> matcher)
throws CobiGenRuntimeException {

bot.waitUntil(new DefaultCondition() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.google.common.base.Preconditions;

/**
Expand Down Expand Up @@ -63,7 +64,7 @@ public static void setTimeout() {
*
* @param timeout the timeout value, in milliseconds
*/
public static void setTimeout(long timeout) {
public static void setTimeout(long timeout) throws CobiGenRuntimeException {

Preconditions.checkArgument(timeout > 0);
oldTimeoutSwtPrefs = getSwtBotPrefsTimeoutFieldValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;

Expand Down Expand Up @@ -213,7 +214,8 @@ public String getFailureMessage() {
* @throws WidgetNotFoundException if the tree item could not be found
* @see <a href="https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2569">issue 2569</a>
*/
public static SWTBotTreeItem select(SWTWorkbenchBot bot, SWTBotTree tree, String... nodeNames) {
public static SWTBotTreeItem select(SWTWorkbenchBot bot, SWTBotTree tree, String... nodeNames)
throws CobiGenRuntimeException {

Preconditions.checkArgument(nodeNames.length > 0, "no children to navigate");
int leafIndex = nodeNames.length - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Comparator;
import java.util.UUID;

import org.apache.log4j.MDC;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
Expand All @@ -25,8 +26,8 @@
import org.eclipse.ui.handlers.HandlerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.devonfw.cobigen.eclipse.common.constants.InfrastructureConstants;
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
import com.devonfw.cobigen.eclipse.common.tools.ExceptionHandler;
Expand All @@ -49,7 +50,7 @@ public class AdaptTemplatesHandler extends AbstractHandler {
IPath ws = ResourcesPluginUtil.getWorkspaceLocation();

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
public Object execute(ExecutionEvent event) throws ExecutionException, CobiGenRuntimeException {

MDC.put(InfrastructureConstants.CORRELATION_ID, UUID.randomUUID().toString());
IProject generatorProj = ResourcesPlugin.getWorkspace().getRoot().getProject(ResourceConstants.CONFIG_PROJECT_NAME);
Expand Down

0 comments on commit 9d4ca8b

Please sign in to comment.