CWM-7558, CWM-4279: show placeholder for unimplemented toolwindows & allow to ask permission from toolwindows

GitOrigin-RevId: a4e81df789112db59f79fd141befe62bded6d404
This commit is contained in:
Maria Filipanova
2023-01-16 14:56:42 +01:00
committed by intellij-monorepo-bot
parent 1f01dd381c
commit b755d64288
3 changed files with 31 additions and 6 deletions

View File

@@ -9,5 +9,5 @@ class DependencyToolWindowViewModelExtractor : ToolWindowViewModelExtractor {
override fun isApplicable(toolWindowId: String, clientId: ClientId?) =
toolWindowId == DependencyToolWindowFactory.DEPENDENCIES_TOOL_WINDOW_ID
override fun getMode() = ToolWindowExtractorMode.DISABLE
override fun getMode() = ToolWindowExtractorMode.UNSUPPORTED
}

View File

@@ -124,6 +124,14 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr
public EditorNotificationPanel(@Nullable Editor editor,
@Nullable Color backgroundColor,
@Nullable ColorKey backgroundColorKey) {
this(editor, backgroundColor, backgroundColorKey, false);
}
@ApiStatus.Experimental
public EditorNotificationPanel(@Nullable Editor editor,
@Nullable Color backgroundColor,
@Nullable ColorKey backgroundColorKey,
boolean actionLabelsNextToText) {
super(new BorderLayout());
mySchemeSupplier = editor != null ? () -> editor.getColorsScheme() : GLOBAL_SCHEME_SUPPLIER;
@@ -131,9 +139,16 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr
myBackgroundColorKey = backgroundColorKey != null ? backgroundColorKey : EditorColors.NOTIFICATION_BACKGROUND;
putClientProperty(FileEditorManager.SEPARATOR_COLOR, JBUI.CurrentTheme.Editor.BORDER_COLOR);
JPanel panel = new NonOpaquePanel(new BorderLayout());
panel.add(BorderLayout.CENTER, myLabel);
panel.add(BorderLayout.EAST, myLinksPanel);
JPanel panel;
if (actionLabelsNextToText) {
panel = new NonOpaquePanel(new HorizontalLayout(8));
panel.add(myLabel);
panel.add(myLinksPanel);
} else {
panel = new NonOpaquePanel(new BorderLayout());
panel.add(BorderLayout.CENTER, myLabel);
panel.add(BorderLayout.EAST, myLinksPanel);
}
panel.setMinimumSize(new Dimension(0, 0));
Wrapper gearWrapper = new Wrapper(myGearLabel);

View File

@@ -15,8 +15,9 @@ import org.jetbrains.annotations.ApiStatus;
* <li>Default mode is used:</li>
* <ul>
* <li>{@link #MIRROR} for few common toolwindows for CWM guests</li>
* <li>{@link #FALLBACK} for all other toolwindows for CWM guests</li>
* <li>{@link #FALLBACK} for some toolwindows for Remote Dev controller</li>
* <li>{@link #PROJECTOR_STEALING} for Remote Dev controller client</li>
* <li>{@link #UNSUPPORTED} for all other toolwindows for CWM guests</li>
* </ul>
* </ol>
*/
@@ -48,7 +49,12 @@ public enum ToolWindowExtractorMode {
* Steal content from host's toolwindow to share it using Projector.
* Applicable only for Remote Dev controller client.
*/
PROJECTOR_STEALING;
PROJECTOR_STEALING,
/**
* Returned for toolwindow whose synchronization with host we don't really support. For toolwindows,
* which client actually has, it will work as {@link #FALLBACK}, for others it will show placeholder with unimplemented message.
*/
UNSUPPORTED;
/**
* Returns true for modes that create a new toolwindow instance per client
@@ -64,6 +70,10 @@ public enum ToolWindowExtractorMode {
return this == MIRROR || this == PROJECTOR_STEALING;
}
public boolean isUnsupported() {
return this == UNSUPPORTED;
}
/**
* Returns true for modes that rely on Projector to transfer toolwindow contents
* Applicable only to Remote Dev controller client