-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathUBIIntentionAction.java
More file actions
55 lines (45 loc) · 2.02 KB
/
Copy pathUBIIntentionAction.java
File metadata and controls
55 lines (45 loc) · 2.02 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*******************************************************************************
* Copyright (c) 2024 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.intellij.image;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.util.IntentionFamilyName;
import com.intellij.codeInspection.util.IntentionName;
import org.jboss.tools.intellij.image.build.filetype.DockerfileFileType;
import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import java.net.URI;
public class UBIIntentionAction implements IntentionAction {
public static final String UBI9_BASE_IMAGE_LINK = "https://catalog.redhat.com/software/containers/ubi9/ubi/615bcf606feffc5384e8452e?architecture=amd64&image=66993ed7cb27bf20e0cf2d27";
@Override
public @IntentionName @NotNull String getText() {
return "Switch to UBI 9 for enhanced security and enterprise-grade stability";
}
@Override
public @NotNull @IntentionFamilyName String getFamilyName() {
return "RHDA";
}
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile psiFile) {
return DockerfileFileType.isDockerfile(psiFile);
}
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException {
BrowserUtil.browse(URI.create(UBI9_BASE_IMAGE_LINK));
}
@Override
public boolean startInWriteAction() {
return false;
}
}