Skip to content
Closed
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
Empty file added bundle/icons/.gitignore
Empty file.
Binary file modified bundle/icons/critical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundle/icons/criticalnotapplic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bundle/icons/high.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundle/icons/highnotapplic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bundle/icons/low.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundle/icons/lownotapplic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bundle/icons/medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundle/icons/mediumnotapplic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bundle/icons/unknown.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundle/icons/unknownnotapplic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</repositories>

<properties>
<ide-plugins-common-version>2.4.0</ide-plugins-common-version>
<ide-plugins-common-version>2.4.1</ide-plugins-common-version>
</properties>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.jfrog.ide.eclipse.configuration;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

import com.jfrog.ide.common.configuration.JfrogCliDriver;
import com.jfrog.ide.eclipse.log.Logger;

public class CliDriverWrapper {

private static CliDriverWrapper instance;

public static final String CLIENT_ID_SERVER = "eclipse";
public static final String CLI_VERSION = "2.74.1";
public static final Path HOME_PATH = Paths.get(System.getProperty("user.home"), ".jfrog-eclipse-plugin");

private JfrogCliDriver cliDriver;

private CliDriverWrapper() {
try {
Files.createDirectories(HOME_PATH);
} catch (Exception e) {
showCliError("An error occurred while creating the JFrog Eclipse plugin directory:",e);
}
// Initialize the cliDriver and download CLI if needed
this.cliDriver = new JfrogCliDriver(null, Logger.getInstance());
try {
this.cliDriver.downloadCliIfNeeded(HOME_PATH.toString(), CLI_VERSION);
} catch (IOException e) {
showCliError("An error occurred while downloading the JFrog CLI:",e);
}
}

public static CliDriverWrapper getInstance() {
if (instance == null) {
synchronized (CliDriverWrapper.class) {
if (instance == null) {
instance = new CliDriverWrapper();
}
}
}
return instance;
}

public JfrogCliDriver getCliDriver() {
return cliDriver;
}

public void showCliError(String errorTitle,Exception e) {
Logger.getInstance().error(e.getMessage(), e);
IStatus status = new Status(IStatus.ERROR, "jfrog-eclipse-plugin",e.getMessage(), e);

// Run UI-related code on the main UI thread
Display.getDefault().asyncExec(() -> {
Shell shell = Display.getDefault().getActiveShell();
if (shell != null) {
ErrorDialog.openError(shell, "Error", errorTitle, status);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class PreferenceConstants {
public static final String XRAY_URL = "URL";
public static final String XRAY_USERNAME = "Username";
public static final String XRAY_PASSWORD = "Password";
public static final String DEBUG_LOGS = "checkboxPreference";

// Connection constants
public static final int CONNECTION_TIMEOUT_MILLISECONDS = 300 * 1000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.jfrog.ide.eclipse.configuration;

import java.io.IOException;

import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.StringFieldEditor;
Expand All @@ -10,8 +13,11 @@
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.preferences.ScopedPreferenceStore;

import com.jfrog.ide.eclipse.log.Logger;
import com.jfrog.ide.eclipse.scan.ScanManager;
import com.jfrog.ide.eclipse.ui.ComponentDetails;
import com.jfrog.ide.eclipse.ui.issues.ComponentIssueDetails;
import com.jfrog.ide.eclipse.ui.issues.IssuesTree;

/**
* Panel for configuring Xray URL, username and password.
Expand All @@ -38,11 +44,14 @@ public void createFieldEditors() {
addField(usernameEditor);
addField(passwordEditor);
addField(new TestConnectionButton(urlEditor, usernameEditor, passwordEditor, getFieldEditorParent()));

BooleanFieldEditor debugLogsCheckbox = new BooleanFieldEditor(PreferenceConstants.DEBUG_LOGS, "Generate Debug Logs",
getFieldEditorParent());
addField(debugLogsCheckbox);
}

@Override
public boolean performOk() {
// TODO: This code runs when clicking the 'Apply' button in the settings panel. Implement server configuration using CliDriver here
super.performOk();
if (!XrayServerConfigImpl.getInstance().areCredentialsSet()) {
return true;
Expand All @@ -56,7 +65,8 @@ public boolean performOk() {
}
}
if (doQuickScan) {
// TODO: run a scan using the ScanManager
ScanManager.getInstance().startScan(getShell().getParent(),
getPreferenceStore().getBoolean(PreferenceConstants.DEBUG_LOGS));
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*/
@SuppressWarnings("restriction")
public class XrayServerConfigImpl implements ServerConfig {
// TODO: adjust implementation for configuring server using JfrogCliDriver

private static XrayServerConfigImpl instance;
private IPreferencesService service = Platform.getPreferencesService();

Expand All @@ -48,6 +46,10 @@ public String getUsername() {
public String getPassword() {
return getValue(PreferenceConstants.XRAY_PASSWORD);
}

public boolean getIsDebugLogs() {
return getValue(PreferenceConstants.DEBUG_LOGS) == "true";
}

private String getValue(String key) {
return trim(service.getString(PreferenceConstants.XRAY_QUALIFIER, key, "", null));
Expand Down Expand Up @@ -110,31 +112,31 @@ public boolean isInsecureTls() {

@Override
public String getAccessToken() {
// TODO Auto-generated method stub
// This functionality is not yet implemented by the plug-in.
return null;
}

@Override
public String getExternalResourcesRepo() {
// TODO Auto-generated method stub
// This functionality is not yet implemented by the plug-in.
return null;
}

@Override
public PolicyType getPolicyType() {
// TODO Auto-generated method stub
// This functionality is not yet implemented by the plug-in.
return null;
}

@Override
public String getProject() {
// TODO Auto-generated method stub
// This functionality is not yet implemented by the plug-in.
return null;
}

@Override
public String getWatches() {
// TODO Auto-generated method stub
// This functionality is not yet implemented by the plug-in.
return null;
}

Expand Down
42 changes: 42 additions & 0 deletions bundle/src/main/java/com/jfrog/ide/eclipse/scan/ScanCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.jfrog.ide.eclipse.scan;

import java.util.ArrayList;
import java.util.List;

import com.jfrog.ide.common.nodes.FileTreeNode;
import com.jfrog.ide.common.utils.XrayConnectionUtils.Results;

public class ScanCache {
private List<FileTreeNode> scanResults;

private static ScanCache instance;

private ScanCache() {
scanResults = new ArrayList<FileTreeNode>();
}

public static ScanCache getInstance() {
if (instance == null) {
synchronized (ScanCache.class) {
if (instance == null) {
instance = new ScanCache();
}
}
}
return instance;
}

public List<FileTreeNode> getScanResults() {
return scanResults;
}

public void updateScanResults(List<FileTreeNode> results) {
if (results != null) {
scanResults.addAll(results);
}
}

public void resetCache() {
scanResults = new ArrayList<FileTreeNode>();
}
}
Loading