-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathPluginStartup.java
More file actions
31 lines (26 loc) · 920 Bytes
/
Copy pathPluginStartup.java
File metadata and controls
31 lines (26 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.checkmarx.eclipse.startup;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import com.checkmarx.eclipse.utils.CxLogger;
public class PluginStartup implements IStartup {
private static final String VIEW_ID = "com.checkmarx.eclipse.views.CheckmarxView";
@Override
public void earlyStartup() {
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
try {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null && page.findView(VIEW_ID) == null) {
page.showView(VIEW_ID);
}
}
} catch (PartInitException e) {
CxLogger.error("Failed to open Checkmarx One view on startup: " + e.getMessage(), e);
}
});
}
}