本文整理汇总了Java中com.intellij.ide.ui.UISettingsListener类的典型用法代码示例。如果您正苦于以下问题:Java UISettingsListener类的具体用法?Java UISettingsListener怎么用?Java UISettingsListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UISettingsListener类属于com.intellij.ide.ui包,在下文中一共展示了UISettingsListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addNotify
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
updateMenuActions();
// Add updater for menus
myActionManager.addTimerListener(1000, new WeakTimerListener(myActionManager, myTimerListener));
UISettingsListener UISettingsListener = new UISettingsListener() {
public void uiSettingsChanged(final UISettings source) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
};
UISettings.getInstance().addUISettingsListener(UISettingsListener, myDisposable);
Disposer.register(ApplicationManager.getApplication(), myDisposable);
IdeEventQueue.getInstance().addDispatcher(this, myDisposable);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IdeMenuBar.java
示例2: PreviewManagerImpl
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public PreviewManagerImpl(Project project) {
myProject = project;
myEmptyStatePanel = new EmptyStatePanel();
PreviewPanelProvider[] providers = PreviewPanelProvider.EP_NAME.getExtensions(project);
for (PreviewPanelProvider provider : providers) {
myProviders.add(provider);
myActiveProviderIds.add(provider.getId());
Disposer.register(project, provider);
}
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
checkGlobalState();
}
}, myProject);
checkGlobalState();
checkEmptyState();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PreviewManagerImpl.java
示例3: MultiMarkdownGlobalSettings
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public MultiMarkdownGlobalSettings() {
// register to settings change on behalf of our listeners. If the UI changes and htmlTheme is Application UI then notify them
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
if (htmlTheme.getValue() == HTML_THEME_UI) {
notifier.notifyListeners(new ListenerNotifier.RunnableNotifier<SettingsListener<MultiMarkdownGlobalSettings>>() {
@Override
public boolean notify(SettingsListener<MultiMarkdownGlobalSettings> listener) {
listener.handleSettingsChanged(MultiMarkdownGlobalSettings.this);
return false;
}
});
}
}
}, this);
}
开发者ID:vsch,项目名称:idea-multimarkdown,代码行数:18,代码来源:MultiMarkdownGlobalSettings.java
示例4: GitStatusWidget
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
private GitStatusWidget(@NotNull Project project) {
super(project);
toolTip = new StatusToolTip(project);
rootActions = new RootActions(project);
myConnection.subscribe(PerRepoInfoCache.CACHE_CHANGE, new PerRepoStatusCacheListener() {
@Override
public void stateChanged(@NotNull RepoInfo info, @NotNull GitRepository repository) {
onCacheChange(info, repository);
}
});
myConnection.subscribe(ConfigNotifier.CONFIG_TOPIC, new ConfigNotifier.Adapter() {
@Override
public void configChanged(GitToolBoxConfig config) {
runUpdateLater();
}
});
myConnection.subscribe(UISettingsListener.TOPIC, uiSettings -> AppUtil.invokeLaterIfNeeded(this::updateStatusBar));
}
开发者ID:zielu,项目名称:GitToolBox,代码行数:19,代码来源:GitStatusWidget.java
示例5: addNotify
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
updateMenuActions();
// Add updater for menus
myActionManager.addTimerListener(1000, new WeakTimerListener(myActionManager, myTimerListener));
UISettingsListener UISettingsListener = new UISettingsListener() {
public void uiSettingsChanged(final UISettings source) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
};
UISettings.getInstance().addUISettingsListener(UISettingsListener, myDisposable);
Disposer.register(ApplicationManager.getApplication(), myDisposable);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:IdeMenuBar.java
示例6: EditorsSplitters
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public EditorsSplitters(final FileEditorManagerImpl manager, DockManager dockManager, boolean createOwnDockableContainer) {
super(new BorderLayout());
setOpaque(false);
myManager = manager;
myFocusWatcher = new MyFocusWatcher();
setFocusTraversalPolicy(new MyFocusTraversalPolicy());
setTransferHandler(new MyTransferHandler());
clear();
if (createOwnDockableContainer) {
DockableEditorTabbedContainer dockable = new DockableEditorTabbedContainer(myManager.getProject(), this, false);
Disposer.register(manager.getProject(), dockable);
dockManager.register(dockable);
}
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateBackground();
}
}, manager.getProject());
updateBackground();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:EditorsSplitters.java
示例7: addNotify
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
updateMenuActions();
// Add updater for menus
myActionManager.addTimerListener(1000, new WeakTimerListener(myActionManager, myTimerListener));
UISettingsListener UISettingsListener = new UISettingsListener() {
@Override
public void uiSettingsChanged(final UISettings source) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
};
UISettings.getInstance().addUISettingsListener(UISettingsListener, myDisposable);
Disposer.register(ApplicationManager.getApplication(), myDisposable);
IdeEventQueue.getInstance().addDispatcher(this, myDisposable);
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:IdeMenuBar.java
示例8: EditorHistoryManager
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
EditorHistoryManager(@Nonnull Project project) {
myProject = project;
MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(UISettingsListener.TOPIC, new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings uiSettings) {
trimToSize();
}
});
connection.subscribe(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER, new FileEditorManagerListener.Before.Adapter() {
@Override
public void beforeFileClosed(@Nonnull FileEditorManager source, @Nonnull VirtualFile file) {
updateHistoryEntry(file, false);
}
});
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyEditorManagerListener());
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:EditorHistoryManager.java
示例9: runActivity
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
@Override
public void runActivity(@Nonnull UIAccess uiAccess, @Nonnull Project project) {
if (project.isDefault() || ApplicationManager.getApplication().isUnitTestMode() || project.isDisposed()) {
return;
}
MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener());
connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() {
@Override
public void fileTypesChanged(@Nonnull FileTypeEvent event) {
reinitBreadcrumbsInAllEditors(project);
}
});
VirtualFileManager.getInstance().addVirtualFileListener(new MyVirtualFileListener(project), project);
connection.subscribe(UISettingsListener.TOPIC, uiSettings -> reinitBreadcrumbsInAllEditors(project));
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:BreadcrumbsInitializingActivity.java
示例10: IdeNotificationArea
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public IdeNotificationArea() {
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateStatus();
}
}, this);
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
EventLog.toggleLog(getProject(), null);
return true;
}
}.installOn(this);
ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(LogModel.LOG_MODEL_CHANGED, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
updateStatus();
}
});
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:IdeNotificationArea.java
示例11: NavBarRootPaneExtension
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public NavBarRootPaneExtension(Project project) {
myProject = project;
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
toggleRunPanel(!source.SHOW_MAIN_TOOLBAR && source.SHOW_NAVIGATION_BAR && !UISettings.getInstance().PRESENTATION_MODE);
}
}, this);
myNavToolbarGroupExist = runToolbarExists();
Disposer.register(myProject, this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:NavBarRootPaneExtension.java
示例12: JBTerminalSystemSettingsProvider
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public JBTerminalSystemSettingsProvider() {
myColorScheme = createBoundColorSchemeDelegate(null);
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
int size;
if (UISettings.getInstance().PRESENTATION_MODE) {
size = UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE;
}
else {
size = myColorScheme.getGlobal().getConsoleFontSize();
}
if (myColorScheme.getConsoleFontSize() != size) {
myColorScheme.setConsoleFontSize(size);
fireFontChanged();
}
}
}, this);
EditorColorsManager.getInstance().addEditorColorsListener(new EditorColorsAdapter() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
myColorScheme.updateGlobalScheme(scheme);
fireFontChanged();
}
}, this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:JBTerminalSystemSettingsProvider.java
示例13: IdeNotificationArea
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public IdeNotificationArea() {
Disposer.register(this, myLogAlarm);
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateStatus();
}
}, this);
new ClickListener() {
@Override
public boolean onClick(MouseEvent e, int clickCount) {
EventLog.toggleLog(getProject());
return true;
}
}.installOn(this);
ApplicationManager.getApplication().getMessageBus().connect().subscribe(LogModel.LOG_MODEL_CHANGED, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
updateStatus();
}
});
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:IdeNotificationArea.java
示例14: JBTerminalSystemSettingsProvider
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public JBTerminalSystemSettingsProvider()
{
myColorScheme = createBoundColorSchemeDelegate(null);
UISettings.getInstance().addUISettingsListener(new UISettingsListener()
{
@Override
public void uiSettingsChanged(UISettings source)
{
int size;
if(UISettings.getInstance().PRESENTATION_MODE)
{
size = UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE;
}
else
{
size = myColorScheme.getGlobal().getConsoleFontSize();
}
if(myColorScheme.getConsoleFontSize() != size)
{
myColorScheme.setConsoleFontSize(size);
fireFontChanged();
}
}
}, this);
EditorColorsManager.getInstance().addEditorColorsListener(new EditorColorsAdapter()
{
@Override
public void globalSchemeChange(EditorColorsScheme scheme)
{
myColorScheme.updateGlobalScheme(scheme);
fireFontChanged();
}
}, this);
}
开发者ID:consulo,项目名称:consulo-terminal,代码行数:38,代码来源:JBTerminalSystemSettingsProvider.java
示例15: ToolWindowsWidget
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
ToolWindowsWidget(@Nonnull Disposable parent) {
new BaseButtonBehavior(this, TimedDeadzone.NULL) {
@Override
protected void execute(MouseEvent e) {
performAction();
}
}.setActionTrigger(MouseEvent.MOUSE_PRESSED);
IdeEventQueue.getInstance().addDispatcher(e -> {
if (e instanceof MouseEvent) {
MouseEvent mouseEvent = (MouseEvent)e;
if (mouseEvent.getComponent() == null || !SwingUtilities.isDescendingFrom(mouseEvent.getComponent(), SwingUtilities.getWindowAncestor(this))) {
return false;
}
if (e.getID() == MouseEvent.MOUSE_MOVED && isShowing()) {
Point p = mouseEvent.getLocationOnScreen();
Point screen = this.getLocationOnScreen();
if (new Rectangle(screen.x - 4, screen.y - 2, getWidth() + 4, getHeight() + 4).contains(p)) {
mouseEntered();
wasExited = false;
}
else {
if (!wasExited) {
wasExited = mouseExited(p);
}
}
}
else if (e.getID() == MouseEvent.MOUSE_EXITED) {
//mouse exits WND
mouseExited(mouseEvent.getLocationOnScreen());
}
}
return false;
}, parent);
ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(UISettingsListener.TOPIC, this);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("focusOwner", this);
myAlarm = new Alarm(parent);
}
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:ToolWindowsWidget.java
示例16: IdeNotificationArea
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
public IdeNotificationArea() {
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateStatus();
}
}, this);
new ClickListener() {
@Override
public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
EventLog.toggleLog(getProject(), null);
return true;
}
}.installOn(this);
ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(LogModel.LOG_MODEL_CHANGED, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
IdeNotificationArea.this.updateStatus();
}
});
}
});
}
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:IdeNotificationArea.java
示例17: DockWindow
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
private DockWindow(String id, Project project, DockContainer container, boolean dialog) {
super(project, null, dialog);
myId = id;
myContainer = container;
setProject(project);
if (!(container instanceof DockContainer.Dialog)) {
setStatusBar(WindowManager.getInstance().getStatusBar(project).createChild());
}
myUiContainer = new NonOpaquePanel(new BorderLayout());
NonOpaquePanel center = new NonOpaquePanel(new BorderLayout(0, 2));
if (UIUtil.isUnderAquaLookAndFeel()) {
center.setOpaque(true);
center.setBackground(JBTabsImpl.MAC_AQUA_BG_COLOR);
}
center.add(myNorthPanel, BorderLayout.NORTH);
myDockContentUiContainer = new NonOpaquePanel(new BorderLayout());
myDockContentUiContainer.add(myContainer.getContainerComponent(), BorderLayout.CENTER);
center.add(myDockContentUiContainer, BorderLayout.CENTER);
myUiContainer.add(center, BorderLayout.CENTER);
if (myStatusBar != null) {
myUiContainer.add(myStatusBar.getComponent(), BorderLayout.SOUTH);
}
setComponent(myUiContainer);
addDisposable(container);
IdeEventQueue.getInstance().addPostprocessor(this, this);
myContainer.addListener(new DockContainer.Listener.Adapter() {
@Override
public void contentRemoved(Object key) {
getReady().doWhenDone(new Runnable() {
@Override
public void run() {
if (myContainer.isEmpty()) {
close();
}
}
});
}
}, this);
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateNorthPanel();
}
}, this);
updateNorthPanel();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:58,代码来源:DockManagerImpl.java
示例18: EditorTabbedContainer
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
EditorTabbedContainer(final EditorWindow window, Project project, final int tabPlacement) {
myWindow = window;
myProject = project;
final ActionManager actionManager = ActionManager.getInstance();
myTabs = new JBEditorTabs(project, actionManager, IdeFocusManager.getInstance(project), this);
myTabs.setDataProvider(new MyDataProvider()).setPopupGroup(new Getter<ActionGroup>() {
public ActionGroup get() {
return (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_EDITOR_TAB_POPUP);
}
}, ActionPlaces.EDITOR_TAB_POPUP, false).setNavigationActionsEnabled(false).addTabMouseListener(new TabMouseListener()).getPresentation()
.setTabDraggingEnabled(true).setUiDecorator(new UiDecorator() {
@NotNull
public UiDecoration getDecoration() {
return new UiDecoration(null, new Insets(TabsUtil.TAB_VERTICAL_PADDING, 10, TabsUtil.TAB_VERTICAL_PADDING, 10));
}
}).setTabLabelActionsMouseDeadzone(TimedDeadzone.NULL).setGhostsAlwaysVisible(true).setTabLabelActionsAutoHide(false)
.setActiveTabFillIn(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground()).setPaintFocus(false).getJBTabs()
.addListener(new TabsListener.Adapter() {
public void selectionChanged(final TabInfo oldSelection, final TabInfo newSelection) {
final FileEditorManager editorManager = FileEditorManager.getInstance(myProject);
final FileEditor oldEditor = oldSelection != null ? editorManager.getSelectedEditor((VirtualFile)oldSelection.getObject()) : null;
if (oldEditor != null) {
oldEditor.deselectNotify();
}
final FileEditor newEditor = editorManager.getSelectedEditor((VirtualFile)newSelection.getObject());
if (newEditor != null) {
newEditor.selectNotify();
}
}
}).setAdditionalSwitchProviderWhenOriginal(new MySwitchProvider())
.setSelectionChangeHandler(new JBTabs.SelectionChangeHandler() {
@NotNull
@Override
public ActionCallback execute(TabInfo info, boolean requestFocus, @NotNull final ActiveRunnable doChangeSelection) {
final ActionCallback result = new ActionCallback();
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
@Override
public void run() {
((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(myProject)).onSelectionChanged();
result.notify(doChangeSelection.run());
}
}, "EditorChange", null);
return result;
}
}).getPresentation().setRequestFocusOnLastFocusedComponent(true);
myTabs.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (myTabs.findInfo(e) != null || isFloating()) return;
if (!e.isPopupTrigger() && SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
final ActionManager mgr = ActionManager.getInstance();
mgr.tryToExecute(mgr.getAction("HideAllWindows"), e, null, ActionPlaces.UNKNOWN, true);
}
}
});
setTabPlacement(UISettings.getInstance().EDITOR_TAB_PLACEMENT);
updateTabBorder();
((ToolWindowManagerEx)ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
public void stateChanged() {
updateTabBorder();
}
public void toolWindowRegistered(@NotNull final String id) {
updateTabBorder();
}
});
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
public void uiSettingsChanged(UISettings source) {
updateTabBorder();
}
}, this);
Disposer.register(project, this);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:80,代码来源:EditorTabbedContainer.java
示例19: DockWindow
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
private DockWindow(String id, Project project, DockContainer container, boolean dialog) {
super(project, null, dialog);
myId = id;
myContainer = container;
setProject(project);
if (!(container instanceof DockContainer.Dialog)) {
setStatusBar(WindowManager.getInstance().getStatusBar(project).createChild());
}
myUiContainer = new NonOpaquePanel(new BorderLayout());
NonOpaquePanel center = new NonOpaquePanel(new BorderLayout(0, 2));
if (UIUtil.isUnderAquaLookAndFeel()) {
center.setOpaque(true);
center.setBackground(JBTabsImpl.MAC_AQUA_BG_COLOR);
}
center.add(myNorthPanel, BorderLayout.NORTH);
myDockContentUiContainer = new NonOpaquePanel(new BorderLayout());
myDockContentUiContainer.add(myContainer.getContainerComponent(), BorderLayout.CENTER);
center.add(myDockContentUiContainer, BorderLayout.CENTER);
myUiContainer.add(center, BorderLayout.CENTER);
if (!(container instanceof DockContainer.Dialog)) {
myUiContainer.add(myStatusBar.getComponent(), BorderLayout.SOUTH);
}
setComponent(myUiContainer);
addDisposable(container);
IdeEventQueue.getInstance().addPostprocessor(this, this);
myContainer.addListener(new DockContainer.Listener.Adapter() {
@Override
public void contentRemoved(Object key) {
getReady().doWhenDone(new Runnable() {
@Override
public void run() {
if (myContainer.isEmpty()) {
close();
}
}
});
}
}, this);
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(UISettings source) {
updateNorthPanel();
}
}, this);
updateNorthPanel();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:58,代码来源:DockManagerImpl.java
示例20: EditorTabbedContainer
import com.intellij.ide.ui.UISettingsListener; //导入依赖的package包/类
EditorTabbedContainer(final DesktopEditorWindow window, Project project) {
myWindow = window;
myProject = project;
final ActionManager actionManager = ActionManager.getInstance();
myTabs = new JBEditorTabs(project, actionManager, IdeFocusManager.getInstance(project), this);
myTabs.setBorder(new MyShadowBorder(myTabs));
myTabs.setTransferHandler(new MyTransferHandler());
myTabs.setDataProvider(new MyDataProvider())
.setPopupGroup(() -> (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_EDITOR_TAB_POPUP),
ActionPlaces.EDITOR_TAB_POPUP, false).addTabMouseListener(new TabMouseListener()).getPresentation().setTabDraggingEnabled(true)
.setUiDecorator(() -> new UiDecorator.UiDecoration(null, new Insets(TabsUtil.TAB_VERTICAL_PADDING, 8, TabsUtil.TAB_VERTICAL_PADDING, 8)))
.setTabLabelActionsMouseDeadzone(TimedDeadzone.NULL).setGhostsAlwaysVisible(true).setTabLabelActionsAutoHide(false)
.setActiveTabFillIn(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground()).setPaintFocus(false).getJBTabs()
.addListener(new TabsListener.Adapter() {
@Override
public void selectionChanged(final TabInfo oldSelection, final TabInfo newSelection) {
final FileEditorManager editorManager = FileEditorManager.getInstance(myProject);
final FileEditor oldEditor = oldSelection != null ? editorManager.getSelectedEditor((VirtualFile)oldSelection.getObject()) : null;
if (oldEditor != null) {
oldEditor.deselectNotify();
}
VirtualFile newFile = (VirtualFile)newSelection.getObject();
final FileEditor newEditor = editorManager.getSelectedEditor(newFile);
if (newEditor != null) {
newEditor.selectNotify();
}
if (GeneralSettings.getInstance().isSyncOnFrameActivation()) {
VfsUtil.markDirtyAndRefresh(true, false, false, newFile);
}
}
}).setSelectionChangeHandler((info, requestFocus, doChangeSelection) -> {
final ActionCallback result = new ActionCallback();
CommandProcessor.getInstance().executeCommand(myProject, () -> {
((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(myProject)).onSelectionChanged();
result.notify(doChangeSelection.run());
}, "EditorChange", null);
return result;
}).getPresentation().setRequestFocusOnLastFocusedComponent(true);
myTabs.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (myTabs.findInfo(e) != null || isFloating()) return;
if (!e.isPopupTrigger() && SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
final ActionManager mgr = ActionManager.getInstance();
mgr.tryToExecute(mgr.getAction("HideAllWindows"), e, null, ActionPlaces.UNKNOWN, true);
}
}
});
setTabPlacement(UISettings.getInstance().EDITOR_TAB_PLACEMENT);
updateTabBorder();
((ToolWindowManagerEx)ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
@Override
public void stateChanged() {
updateTabBorder();
}
@Override
public void toolWindowRegistered(@Nonnull final String id) {
updateTabBorder();
}
});
project.getMessageBus().connect().subscribe(UISettingsListener.TOPIC, uiSettings -> updateTabBorder());
Disposer.register(project, this);
}
开发者ID:consulo,项目名称:consulo,代码行数:72,代码来源:EditorTabbedContainer.java
注:本文中的com.intellij.ide.ui.UISettingsListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论