-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Application: Change orientation of editor groups
- Loading branch information
1 parent
b792181
commit 9b9cb58
Showing
4 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...tform-ui/src/main/java/com/shade/platform/ui/editors/menu/ChangeSplitOrientationItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.shade.platform.ui.editors.menu; | ||
|
||
import com.shade.platform.ui.PlatformDataKeys; | ||
import com.shade.platform.ui.editors.stack.EditorStackContainer; | ||
import com.shade.platform.ui.menus.MenuItem; | ||
import com.shade.platform.ui.menus.MenuItemContext; | ||
import com.shade.platform.ui.menus.MenuItemRegistration; | ||
import com.shade.util.NotNull; | ||
|
||
import javax.swing.*; | ||
|
||
import static com.shade.platform.ui.PlatformMenuConstants.*; | ||
|
||
@MenuItemRegistration(parent = CTX_MENU_EDITOR_STACK_ID, name = "Change Split O&rientation", group = CTX_MENU_EDITOR_STACK_GROUP_SPLIT, order = 4000) | ||
public class ChangeSplitOrientationItem extends MenuItem { | ||
@Override | ||
public void perform(@NotNull MenuItemContext ctx) { | ||
EditorStackContainer container = ctx.getData(PlatformDataKeys.EDITOR_STACK_KEY).getContainer().getSplitContainer(); | ||
if (container == null) { | ||
return; | ||
} | ||
|
||
if (container.getSplitOrientation() == JSplitPane.VERTICAL_SPLIT) { | ||
container.setSplitOrientation(JSplitPane.HORIZONTAL_SPLIT); | ||
} else { | ||
container.setSplitOrientation(JSplitPane.VERTICAL_SPLIT); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isVisible(@NotNull MenuItemContext ctx) { | ||
return ctx.getData(PlatformDataKeys.EDITOR_STACK_KEY).getContainer().getSplitContainer() != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters