本文整理汇总了Java中com.intellij.openapi.wm.IdeFocusManager类的典型用法代码示例。如果您正苦于以下问题:Java IdeFocusManager类的具体用法?Java IdeFocusManager怎么用?Java IdeFocusManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IdeFocusManager类属于com.intellij.openapi.wm包,在下文中一共展示了IdeFocusManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createComponent
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@Nullable
@Override
public JComponent createComponent() {
if (!PropertiesComponent.getInstance().getBoolean(COURSE_CREATOR_ENABLED)) return null;
if (CCSettings.getInstance().useHtmlAsDefaultTaskFormat()) {
myHtmlRadioButton.setSelected(true);
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(
() -> IdeFocusManager.getGlobalInstance().requestFocus(myHtmlRadioButton, true));
}
else {
myMarkdownRadioButton.setSelected(true);
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(
() -> IdeFocusManager.getGlobalInstance().requestFocus(myMarkdownRadioButton, true));
}
return myPanel;
}
示例2: createLanguagePopup
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final CodeFragmentFactory fragmentFactory : DebuggerUtilsEx.getCodeFragmentFactories(myContext)) {
actions.add(new AnAction(fragmentFactory.getFileType().getLanguage().getDisplayName(), null, fragmentFactory.getFileType().getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
setFactory(fragmentFactory);
setText(getText());
IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(this);
return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext,
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
}
示例3: toggleRadioEnablement
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
private void toggleRadioEnablement() {
UIUtil.setEnabled(myExistingClassPanel, useExistingClassButton.isSelected(), true);
UIUtil.setEnabled(myNewClassPanel, createNewClassButton.isSelected(), true);
UIUtil.setEnabled(myCreateInnerPanel, myCreateInnerClassButton.isSelected(), true);
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
if (useExistingClassButton.isSelected()) {
focusManager.requestFocus(existingClassField, true);
}
else if (myCreateInnerClassButton.isSelected()) {
focusManager.requestFocus(myInnerClassNameTextField, true);
}
else {
focusManager.requestFocus(classNameField, true);
}
validateButtons();
}
示例4: applyRequest
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@CalledInAwt
protected void applyRequest(@NotNull DiffRequest request, boolean force, @Nullable ScrollToPolicy scrollToChangePolicy) {
myIterationState = IterationState.NONE;
force = force || (myQueuedApplyRequest != null && myQueuedApplyRequest.force);
myQueuedApplyRequest = new ApplyData(request, force, scrollToChangePolicy);
Runnable task = new Runnable() {
@Override
public void run() {
if (myQueuedApplyRequest == null || myDisposed) return;
doApplyRequest(myQueuedApplyRequest.request, myQueuedApplyRequest.force, myQueuedApplyRequest.scrollToChangePolicy);
myQueuedApplyRequest = null;
}
};
IdeFocusManager.getInstance(myProject).doWhenFocusSettlesDown(task);
}
示例5: showBalloonForActiveFrame
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
public static void showBalloonForActiveFrame(@NotNull final String message, final MessageType type) {
final Runnable runnable = new Runnable() {
public void run() {
final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
if (frame == null) {
final Project[] projects = ProjectManager.getInstance().getOpenProjects();
final Project project = projects == null || projects.length == 0 ? ProjectManager.getInstance().getDefaultProject() : projects[0];
final JFrame jFrame = WindowManager.getInstance().getFrame(project);
if (jFrame != null) {
showBalloonForComponent(jFrame, message, type, true, project);
} else {
LOG.info("Can not get component to show message: " + message);
}
return;
}
showBalloonForComponent(frame.getComponent(), message, type, true, frame.getProject());
}
};
UIUtil.invokeLaterIfNeeded(runnable);
}
示例6: JBEditorTabs
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
public JBEditorTabs(@Nullable Project project, @NotNull ActionManager actionManager, IdeFocusManager focusManager, @NotNull Disposable parent) {
super(project, actionManager, focusManager, parent);
Registry.get(TABS_ALPHABETICAL_KEY).addListener(new RegistryValueListener.Adapter() {
@Override
public void afterValueChanged(RegistryValue value) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
resetTabsCache();
relayout(true, false);
}
});
}
}, parent);
}
示例7: writeExternal
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@Deprecated
public void writeExternal(Element element) throws WriteExternalException {
XmlSerializer.serializeInto(getState(), element);
if (USE_PROXY_PAC && USE_HTTP_PROXY && !ApplicationManager.getApplication().isDisposed()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
if (frame != null) {
USE_PROXY_PAC = false;
Messages.showMessageDialog(frame.getComponent(), "Proxy: both 'use proxy' and 'autodetect proxy' settings were set." +
"\nOnly one of these options should be selected.\nPlease re-configure.",
"Proxy Setup", Messages.getWarningIcon());
editConfigurable(frame.getComponent());
}
}
}, ModalityState.NON_MODAL);
}
}
示例8: createSelectMeListener
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
/**
* On event change selection and probably requests focus. Is used when we want
* navigate from other component to this
*
* @return Listener
*/
public PropagateSelectionHandler createSelectMeListener() {
return new PropagateSelectionHandler() {
public void handlePropagateSelectionRequest(@Nullable final SMTestProxy selectedTestProxy, @NotNull final Object sender,
final boolean requestFocus) {
SMRunnerUtil.addToInvokeLater(new Runnable() {
public void run() {
selectWithoutNotify(selectedTestProxy, null);
// Request focus if necessary
if (requestFocus) {
//myTreeView.requestFocusInWindow();
IdeFocusManager.getInstance(myProject).requestFocus(myTreeView, true);
}
}
});
}
};
}
示例9: actionPerformed
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
MacrosDialog dialog = new MacrosDialog(myProject);
if (dialog.showAndGet() && dialog.getSelectedMacro() != null) {
String macro = dialog.getSelectedMacro().getName();
int position = myTextField.getCaretPosition();
try {
myTextField.getDocument().insertString(position, "$" + macro + "$", null);
myTextField.setCaretPosition(position + macro.length() + 2);
}
catch (BadLocationException ignored) {
}
;
}
IdeFocusManager.findInstance().requestFocus(myTextField, true);
}
示例10: RunnerLayoutUiImpl
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
public RunnerLayoutUiImpl(@NotNull Project project,
@NotNull Disposable parent,
@NotNull String runnerId,
@NotNull String runnerTitle,
@NotNull String sessionName) {
myLayout = RunnerLayoutSettings.getInstance().getLayout(runnerId);
Disposer.register(parent, this);
myContentUI = new RunnerContentUi(project, this, ActionManager.getInstance(), IdeFocusManager.getInstance(project), myLayout,
runnerTitle + " - " + sessionName);
Disposer.register(this, myContentUI);
myViewsContentManager = getContentFactory().createContentManager(myContentUI.getContentUI(), false, project);
myViewsContentManager.addDataProvider(this);
Disposer.register(this, myViewsContentManager);
}
示例11: setDisplayed
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
/**
* Displays the presentation to the user.
*/
public void setDisplayed(boolean visible){
createHelpWindow();
if(myModallyActivated){
myDialog.setVisible(visible);
if(visible){
myDialog.setLocationRelativeTo(myDialog.getOwner());
}
} else{
//myFrame.setLocationRelativeTo(null);
myFrame.setVisible(visible);
myFrame.setState(JFrame.NORMAL);
IdeFocusManager focusManager = IdeFocusManager.findInstance();
JComponent target = focusManager.getFocusTargetFor(myFrame.getRootPane());
focusManager.requestFocus(target != null ? target : myFrame, true);
}
}
示例12: focusKey
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
public void focusKey() {
myKeyField.selectAll();
//todo[peter,kirillk] without these invokeLaters this requestFocus conflicts with com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.MyDialog.MyWindowListener.windowOpened()
IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true);
final ModalityState modalityState = ModalityState.stateForComponent(myKeyField);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true);
}
}, modalityState);
}
}, modalityState);
}
}, modalityState);
}
示例13: notifyPublisher
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@NotNull
@Override
public ActionCallback notifyPublisher(@NotNull final Runnable runnable) {
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
final ActionCallback done = new ActionCallback();
return myBusyObject.execute(new ActiveRunnable() {
@NotNull
@Override
public ActionCallback run() {
focusManager.doWhenFocusSettlesDown(new ExpirableRunnable.ForProject(myProject) {
@Override
public void run() {
runnable.run();
done.setDone();
}
});
return done;
}
});
}
示例14: canShow
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
@Override
public boolean canShow(DiffRequest request) {
final DiffContent[] contents = request.getContents();
final DialogWrapper instance = DialogWrapper.findInstance(IdeFocusManager.getInstance(request.getProject()).getFocusOwner());
if (instance != null && instance.isModal()) return false;
if (contents.length == 2) {
final VirtualFile file1 = contents[0].getFile();
final VirtualFile file2 = contents[1].getFile();
if (file1 != null && file2 != null) {
final FileType type1 = contents[0].getContentType();
final FileType type2 = contents[1].getContentType();
return type1 == type2 && type1 instanceof ArchiveFileType;
}
}
return false;
}
示例15: disposeFocusTrackbackIfNoChildWindowFocused
import com.intellij.openapi.wm.IdeFocusManager; //导入依赖的package包/类
private void disposeFocusTrackbackIfNoChildWindowFocused(@Nullable IdeFocusManager focusManager) {
if (myFocusTrackback == null) return;
final DialogWrapper wrapper = myDialogWrapper.get();
if (wrapper == null || !wrapper.isShowing()) {
myFocusTrackback.dispose();
return;
}
if (focusManager != null) {
final Component c = focusManager.getFocusedDescendantFor(wrapper.getContentPane());
if (c == null) {
myFocusTrackback.dispose();
}
}
else {
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner == null || !SwingUtilities.isDescendingFrom(owner, wrapper.getContentPane())) {
myFocusTrackback.dispose();
}
}
}