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 @@ -6,6 +6,7 @@

import com.vaadin.plugin.debug.SilentExceptionFilter;
import com.vaadin.plugin.launch.ServerLaunchListener;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Bundle activator that starts the REST service when the plug-in is activated and stops it on shutdown.
Expand Down Expand Up @@ -37,8 +38,7 @@ public void start(BundleContext context) throws Exception {
// Update all dotfiles with the current endpoint
dotfileManager.updateAllDotfiles();
} catch (Exception e) {
System.err.println("Failed to start Vaadin Eclipse Plugin: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to start Vaadin Eclipse Plugin: " + e.getMessage(), e);
// Clean up any partially initialized resources
stop(context);
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Client for communicating with the Copilot REST service.
Expand Down Expand Up @@ -128,7 +129,7 @@ private Optional<JsonObject> sendForJson(String command, Object dataCommand)
HttpResponse<String> response = send(command, dataCommand);

if (response.statusCode() != 200) {
System.err.println("Unexpected response (" + response.statusCode() + ") communicating with the IDE plugin: "
VaadinPluginLog.error("Unexpected response (" + response.statusCode() + ") communicating with the IDE plugin: "
+ response.body());
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Manages the .copilot-plugin dotfile for Vaadin projects. Creates the dotfile in .eclipse folder when a Vaadin project
Expand Down Expand Up @@ -107,7 +108,7 @@ else if (delta.getKind() == IResourceDelta.CHANGED
}
});
} catch (CoreException e) {
e.printStackTrace();
VaadinPluginLog.error("Error in resource change listener", e);
}
} else if (event.getType() == IResourceChangeEvent.PRE_CLOSE
|| event.getType() == IResourceChangeEvent.PRE_DELETE) {
Expand Down Expand Up @@ -223,17 +224,16 @@ private void createDotfile(IProject project) {
}
} catch (CoreException e) {
// Log but don't fail - refresh is not critical
System.err.println("Failed to refresh project " + project.getName() + ": " + e.getMessage());
VaadinPluginLog.error("Failed to refresh project " + project.getName() + ": " + e.getMessage());
}
});
refreshJob.setRule(project);
refreshJob.schedule(100); // Small delay to ensure resource tree is unlocked

System.out.println("Created .copilot-plugin dotfile for project: " + project.getName());
VaadinPluginLog.info("Created .copilot-plugin dotfile for project: " + project.getName());

} catch (Exception e) {
System.err.println("Failed to create dotfile for project " + project.getName() + ": " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to create dotfile for project " + project.getName() + ": " + e.getMessage(), e);
}
}

Expand All @@ -250,11 +250,11 @@ private void removeDotfile(IProject project) {
Path dotfilePath = Paths.get(projectLocation.toString(), ECLIPSE_FOLDER, DOTFILE_NAME);
if (Files.exists(dotfilePath)) {
Files.delete(dotfilePath);
System.out.println("Removed .copilot-plugin dotfile for project: " + project.getName());
VaadinPluginLog.info("Removed .copilot-plugin dotfile for project: " + project.getName());
}

} catch (Exception e) {
System.err.println("Failed to remove dotfile for project " + project.getName() + ": " + e.getMessage());
VaadinPluginLog.error("Failed to remove dotfile for project " + project.getName() + ": " + e.getMessage());
}
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Manages undo/redo operations for Copilot file modifications.
Expand Down Expand Up @@ -74,8 +75,7 @@ public void recordOperation(IFile file, String oldContent, String newContent, St
fileOperations.computeIfAbsent(filePath, k -> new ArrayList<>()).add(operation);

} catch (Exception e) {
System.err.println("Failed to record operation: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to record operation: " + e.getMessage(), e);
}
}

Expand Down Expand Up @@ -116,8 +116,7 @@ public boolean performUndo(List<String> filePaths) {
}
}
} catch (Exception e) {
System.err.println("Error performing undo: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Error performing undo: " + e.getMessage(), e);
}

return performed;
Expand All @@ -144,8 +143,7 @@ public boolean performRedo(List<String> filePaths) {
}
}
} catch (Exception e) {
System.err.println("Error performing redo: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Error performing redo: " + e.getMessage(), e);
}

return performed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Arrays;
import java.util.UUID;
import java.util.stream.Collectors;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Utility class for Copilot integration.
Expand Down Expand Up @@ -41,10 +42,9 @@ public static void saveDotFile(String projectBasePath, int port) {
props.store(fos, "Vaadin Copilot Integration Runtime Properties");
}

System.out.println("Created copilot dotfile at: " + dotFile.getAbsolutePath());
VaadinPluginLog.info("Created copilot dotfile at: " + dotFile.getAbsolutePath());
} catch (Exception e) {
System.err.println("Failed to create copilot dotfile: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to create copilot dotfile: " + e.getMessage(), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Build participant that generates files in the output folder during compilation. These files will be automatically
Expand All @@ -35,23 +36,23 @@ protected IProject[] build(int kind, java.util.Map<String, String> args, IProgre
throws CoreException {

IProject project = getProject();
System.out.println(
VaadinPluginLog.debug(
"VaadinBuildParticipant.build() called for project: " + (project != null ? project.getName() : "null"));

if (project == null || !project.isAccessible()) {
System.out.println(" - Project is null or not accessible");
VaadinPluginLog.debug(" - Project is null or not accessible");
return null;
}

// Check if this is a Java project
if (!project.hasNature(JavaCore.NATURE_ID)) {
System.out.println(" - Not a Java project");
VaadinPluginLog.debug(" - Not a Java project");
return null;
}

// Check if project has Vaadin dependencies
boolean hasVaadin = hasVaadinDependency(project);
System.out.println(" - Has Vaadin dependencies: " + hasVaadin);
VaadinPluginLog.debug(" - Has Vaadin dependencies: " + hasVaadin);

if (!hasVaadin) {
return null;
Expand Down Expand Up @@ -80,14 +81,14 @@ private boolean hasVaadinDependency(IProject project) {
// Check for Vaadin in the filename only (not the full path)
// This avoids false positives from temp directories containing "vaadin"
if (filename.contains("vaadin")) {
System.out.println(" Found Vaadin dependency: " + entry.getPath());
VaadinPluginLog.debug(" Found Vaadin dependency: " + entry.getPath());
return true;
}
}
}
} catch (Exception e) {
// If we can't determine, assume no Vaadin dependency
System.err.println("Error checking for Vaadin dependencies: " + e.getMessage());
VaadinPluginLog.error("Error checking for Vaadin dependencies: " + e.getMessage());
}

return false;
Expand Down Expand Up @@ -167,10 +168,10 @@ private void updateFlowBuildInfo(IProject project, IProgressMonitor monitor) {
vaadinFolder.setDerived(true, monitor);
configFolder.setDerived(true, monitor);

System.out.println("Updated flow-build-info.json in output folder: " + configFolder.getFullPath());
VaadinPluginLog.info("Updated flow-build-info.json in output folder: " + configFolder.getFullPath());

} catch (Exception e) {
System.err.println("Failed to update flow-build-info.json: " + e.getMessage());
VaadinPluginLog.error("Failed to update flow-build-info.json: " + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.JavaCore;

import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Automatically adds the Vaadin builder to Java projects. The builder itself will check for Vaadin dependencies.
*/
Expand All @@ -20,13 +22,13 @@ public class VaadinBuilderConfigurator implements IResourceChangeListener {
public static void initialize() {
if (instance == null) {
instance = new VaadinBuilderConfigurator();
System.out.println("VaadinBuilderConfigurator: Initializing...");
VaadinPluginLog.info("VaadinBuilderConfigurator: Initializing...");

ResourcesPlugin.getWorkspace().addResourceChangeListener(instance, IResourceChangeEvent.POST_CHANGE);

// Configure existing projects
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
System.out.println("VaadinBuilderConfigurator: Found " + projects.length + " projects");
VaadinPluginLog.info("VaadinBuilderConfigurator: Found " + projects.length + " projects");

for (IProject project : projects) {
instance.configureProject(project);
Expand Down Expand Up @@ -62,15 +64,15 @@ private void processResourceDelta(IResourceDelta delta) {

private void configureProject(IProject project) {
try {
System.out.println("VaadinBuilderConfigurator: Checking project " + project.getName());
VaadinPluginLog.debug("VaadinBuilderConfigurator: Checking project " + project.getName());

if (!project.isOpen()) {
System.out.println(" - Project is not open");
VaadinPluginLog.debug(" - Project is not open");
return;
}

if (!project.hasNature(JavaCore.NATURE_ID)) {
System.out.println(" - Not a Java project");
VaadinPluginLog.debug(" - Not a Java project");
return;
}

Expand All @@ -80,7 +82,7 @@ private void configureProject(IProject project) {
// Check if builder is already present
for (ICommand command : commands) {
if (VaadinBuildParticipant.BUILDER_ID.equals(command.getBuilderName())) {
System.out.println(" - Builder already configured");
VaadinPluginLog.debug(" - Builder already configured");
return; // Already configured
}
}
Expand All @@ -96,10 +98,10 @@ private void configureProject(IProject project) {
desc.setBuildSpec(newCommands);
project.setDescription(desc, null);

System.out.println(" - Added Vaadin builder to project: " + project.getName());
VaadinPluginLog.info(" - Added Vaadin builder to project: " + project.getName());

} catch (CoreException e) {
System.out.println(" - Error configuring project: " + e.getMessage());
VaadinPluginLog.warning(" - Error configuring project: " + e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.debug.core.IJavaExceptionBreakpoint;
import org.eclipse.jdt.debug.core.IJavaThread;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Debug event listener that filters out SilentException breakpoints to prevent the debugger from stopping unnecessarily
Expand Down Expand Up @@ -43,7 +44,7 @@ public void handleDebugEvents(DebugEvent[] events) {
}
}
} catch (Exception e) {
System.err.println("Error handling debug event: " + e.getMessage());
VaadinPluginLog.error("Error handling debug event: " + e.getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Manages the Hotswap Agent installation and updates. Handles downloading, installing, and version management of
Expand Down Expand Up @@ -51,7 +52,7 @@ private void initializePaths() {
try {
Files.createDirectories(vaadinHomePath);
} catch (IOException e) {
System.err.println("Failed to create Vaadin home directory: " + e.getMessage());
VaadinPluginLog.error("Failed to create Vaadin home directory: " + e.getMessage());
}
}

Expand Down Expand Up @@ -103,16 +104,15 @@ public String installHotswapAgent() {
try (InputStream in = fileUrl.openStream()) {
Files.copy(in, hotswapAgentPath, StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Installed Hotswap Agent version: " + bundledVersion);
VaadinPluginLog.info("Installed Hotswap Agent version: " + bundledVersion);
return bundledVersion;
} else {
System.out.println("Hotswap Agent is up to date: " + installedVersion);
VaadinPluginLog.info("Hotswap Agent is up to date: " + installedVersion);
return installedVersion;
}

} catch (Exception e) {
System.err.println("Failed to install Hotswap Agent: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to install Hotswap Agent: " + e.getMessage(), e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.VMStandin;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Manages JetBrains Runtime (JBR) installation and configuration. JBR is required for enhanced class redefinition
Expand Down Expand Up @@ -56,7 +57,7 @@ private void initializePaths() {
try {
Files.createDirectories(jbrInstallPath);
} catch (IOException e) {
System.err.println("Failed to create JBR directory: " + e.getMessage());
VaadinPluginLog.error("Failed to create JBR directory: " + e.getMessage());
}
}

Expand Down Expand Up @@ -203,7 +204,7 @@ public IVMInstall downloadAndInstallJBR(String javaVersion, IProgressMonitor mon
monitor.subTask("Downloading JBR...");
// Download logic would go here
// For now, we'll just print a message
System.out.println("Would download JBR from: " + downloadUrl);
VaadinPluginLog.debug("Would download JBR from: " + downloadUrl);

monitor.worked(50);

Expand All @@ -220,8 +221,7 @@ public IVMInstall downloadAndInstallJBR(String javaVersion, IProgressMonitor mon
return null; // Would return the installed JBR

} catch (Exception e) {
System.err.println("Failed to download JBR: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to download JBR: " + e.getMessage(), e);
return null;
} finally {
monitor.done();
Expand Down Expand Up @@ -260,8 +260,7 @@ private IVMInstall registerJBR(File javaHome) {
return vm;

} catch (Exception e) {
System.err.println("Failed to register JBR: " + e.getMessage());
e.printStackTrace();
VaadinPluginLog.error("Failed to register JBR: " + e.getMessage(), e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
import com.vaadin.plugin.util.VaadinPluginLog;

/**
* Listener that hooks into server launch events to trigger a build for Vaadin projects. The Vaadin builder will
Expand Down Expand Up @@ -46,7 +47,7 @@ public void launchAdded(ILaunch launch) {

} catch (Exception e) {
// Log but don't fail the launch
System.err.println("Failed to trigger build: " + e.getMessage());
VaadinPluginLog.error("Failed to trigger build: " + e.getMessage());
}
}

Expand Down
Loading
Loading