本文整理汇总了Java中com.intellij.openapi.wm.WindowManager类的典型用法代码示例。如果您正苦于以下问题:Java WindowManager类的具体用法?Java WindowManager怎么用?Java WindowManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WindowManager类属于com.intellij.openapi.wm包,在下文中一共展示了WindowManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleBadRequest
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
private void handleBadRequest(final HybrisHttpResult httpResult, final Project project) {
if (httpResult.getStatusCode() != SC_OK) {
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
if (httpResult.getStatusCode() == SC_NOT_FOUND || httpResult.getStatusCode() == SC_MOVED_TEMPORARILY) {
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(
"Hybris Host URL '" + httpResult.getErrorMessage() + "' was incorrect. Please, check your settings.",
MessageType.ERROR,
null
).setFadeoutTime(FADEOUT_TIME)
.createBalloon().show(
RelativePoint.getCenterOf(statusBar.getComponent()),
Balloon.Position.atRight
);
}
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:18,代码来源:ExecuteHybrisConsole.java
示例2: onSettingsChange
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
@Override
@SuppressWarnings("ConstantConditions")
public void onSettingsChange() {
prepareTemplateSettings();
for (IdeFrame frame : WindowManager.getInstance().getAllProjectFrames()) {
if (frame.getProject() != null) {
String projectTitle = getProjectTitle(frame.getProject());
((IdeFrameImpl)frame).setTitle(projectTitle);
try {
File currentFile = (File)((IdeFrameImpl) frame).getRootPane().getClientProperty("Window.documentFile");
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(currentFile);
IdeFrameImpl.updateTitle((IdeFrameImpl) frame, projectTitle, getFileTitle(frame.getProject(), virtualFile), currentFile);
} catch (Exception e) {
IdeFrameImpl.updateTitle((IdeFrameImpl) frame, projectTitle, null, null);
}
}
}
}
示例3: actionPerformed
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
@Override
void actionPerformed(Project project,
Editor editor,
PsiFile file,
String selectedText,
List<PropTypeBean> propNameList,
Component component) {
PropTypesDialog dialog = new PropTypesDialog(propNameList , component);
dialog.pack();
dialog.setLocationRelativeTo(WindowManager.getInstance().getFrame(project));
dialog.setOnSubmitListener((beans, importMode, esVersion) -> {
Document document = editor.getDocument();
runCommand(project, () -> {
//insert PropTypes Object
insertPropTypesCodeString(document,file,selectedText,beans,esVersion);
//insert import statement
autoInsertImportPropTypes(document,file,importMode);
});
});
dialog.setVisible(true);
}
示例4: generateProject
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GravProjectSettings settings, @NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.gravInstallationPath));
if (vf == null || !GravSdkType.isValidGravSDK(vf)) {
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("Project couldn't be created because Grav Installation isn't valid", MessageType.ERROR, null)
.setFadeoutTime(3500)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
} else {
storage.setDefaultGravDownloadPath(settings.gravInstallationPath);
PropertiesComponent.getInstance().setValue(LAST_USED_GRAV_HOME, new File(settings.gravInstallationPath).getAbsolutePath());
GravProjectGeneratorUtil projectGenerator = new GravProjectGeneratorUtil();
projectGenerator.generateProject(project, baseDir, settings, module);
try {
List<String> includePath = new ArrayList<>();
includePath.add(baseDir.getPath());
PhpIncludePathManager.getInstance(project).setIncludePath(includePath);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例5: moduleCreated
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
@Override
public void moduleCreated(@NotNull Module module) {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
String msg = String.format("Please wait while module for project %s is created", project.getName());
settings = GravProjectSettings.getInstance(project);
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(msg, MessageType.WARNING, null)
.setFadeoutTime(4000)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
VirtualFile[] roots1 = ModuleRootManager.getInstance(module).getContentRoots();
if (roots1.length != 0) {
final VirtualFile src = roots1[0];
settings.withSrcDirectory = withSrcDirectory;
settings.gravInstallationPath = getGravInstallPath().getPath();
// settings.withSrcDirectory =
GravProjectGeneratorUtil generatorUtil = new GravProjectGeneratorUtil();
generatorUtil.generateProject(project, src, settings, module);
}
}
示例6: displayUploadResultBalloonMessage
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
private void displayUploadResultBalloonMessage(String fileName, Boolean isSuccess) {
String message = fileName + " Uploaded Successfully";
MessageType messageType = MessageType.INFO;
if (!isSuccess) {
message = fileName + " Failed to Upload";
messageType = MessageType.ERROR;
}
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder("<h3>" + message + "</h3>", messageType, null)
.setFadeoutTime(3000)
.createBalloon()
.show(RelativePoint.getNorthEastOf(WindowManager.getInstance().getIdeFrame(project).getComponent()),
Balloon.Position.above);
}
示例7: installGtmWidget
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
private void installGtmWidget() {
StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
if (statusBar != null) {
statusBar.addWidget(myStatusWidget, myProject);
myStatusWidget.installed();
if (!GTMRecord.initGtmExePath()) {
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmNotFound, ERROR, null)
.setFadeoutTime(30000)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
Balloon.Position.atRight);
return;
}
if (!GTMRecord.checkVersion()) {
JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmVerOutdated, WARNING, null)
.setFadeoutTime(30000)
.createBalloon()
.show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
Balloon.Position.atRight);
}
}
}
示例8: liveRearrangeDocument
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
public final void liveRearrangeDocument(final Project project ,
final PsiFile psiFile ,
final RearrangerSettings settings,
final Document document,
final int cursorOffset)
{
logger.setLevel(Level.DEBUG); // TODO - remove debugging flag
logger.debug("enter liveRearrangeDocument on thread " + Thread.currentThread().getName());
RearrangerActionHandler.setCsm(CodeStyleManager.getInstance(project));
new CommentUtil(settings); // create CommentUtil singleton
final Window window = WindowManager.getInstance().suggestParentWindow(project);
LiveRearrangerPopup fsp = new LiveRearrangerPopup(settings, psiFile, document, project, window, cursorOffset);
final Parser p = new Parser(project, settings, psiFile);
final ArrayList<ClassEntry> outerClasses = p.parseOuterLevel();
if (outerClasses.size() > 0)
{
final Mover m = new Mover(outerClasses, settings);
final ArrayList resultRuleInstances = m.rearrangeOuterClasses();
fsp.setResultRuleInstances(resultRuleInstances);
fsp.liveRearranger();
}
logger.debug("exit liveRearrangeDocument on thread " + Thread.currentThread().getName());
}
示例9: show
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
public void show() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (isAlreadyShown) {
return;
}
StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
if (null != statusBar && isVisible()) {
statusBar.addWidget(HgIncomingOutgoingWidget.this, myProject);
isAlreadyShown = true;
myProject.getMessageBus().syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, null);
}
}
}, ModalityState.any());
}
示例10: showObjectUpcastedUsageView
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
private void showObjectUpcastedUsageView(final ObjectUpcastedUsageInfo[] usages) {
UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTargetsNodeText(RefactoringBundle.message("replacing.inheritance.with.delegation"));
presentation.setCodeUsagesString(RefactoringBundle.message("instances.casted.to.java.lang.object"));
final String upcastedString = RefactoringBundle.message("instances.upcasted.to.object");
presentation.setUsagesString(upcastedString);
presentation.setTabText(upcastedString);
UsageViewManager manager = UsageViewManager.getInstance(myProject);
manager.showUsages(
new UsageTarget[]{new PsiElement2UsageTargetAdapter(myClass)},
UsageInfoToUsageConverter.convert(new PsiElement[]{myClass}, usages),
presentation
);
WindowManager.getInstance().getStatusBar(myProject).setInfo(RefactoringBundle.message("instances.upcasted.to.java.lang.object.found"));
}
示例11: addLibraryOrderEntry
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
public void addLibraryOrderEntry(final Module module, final Library library) {
Component parent = WindowManager.getInstance().suggestParentWindow(module.getProject());
final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
final OrderEntry[] entries = modelProxy.getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
if (Messages.showYesNoDialog(parent,
ProjectBundle.message("project.roots.replace.library.entry.message", entry.getPresentableName()),
ProjectBundle.message("project.roots.replace.library.entry.title"),
Messages.getInformationIcon()) == Messages.YES) {
modelProxy.removeOrderEntry(entry);
break;
}
}
}
modelProxy.addLibraryEntry(library);
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
myTree.repaint();
}
示例12: show
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
@Messages.YesNoCancelResult
public int show() {
String yesText = ObjectUtils.chooseNotNull(myYesText, Messages.YES_BUTTON);
String noText = ObjectUtils.chooseNotNull(myNoText, Messages.NO_BUTTON);
String cancelText = ObjectUtils.chooseNotNull(myCancelText, Messages.CANCEL_BUTTON);
try {
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
}
}
catch (Exception ignored) {}
int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText, cancelText}, 0, myIcon, myDoNotAskOption);
return buttonNumber == 0 ? Messages.YES : buttonNumber == 1 ? Messages.NO : Messages.CANCEL;
}
示例13: showBalloonForActiveFrame
import com.intellij.openapi.wm.WindowManager; //导入依赖的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);
}
示例14: showYesNoDialog
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
/**
* @return {@link #YES} if user pressed "Yes" or {@link #NO} if user pressed "No" button.
*/
@YesNoResult
public static int showYesNoDialog(@Nullable Project project, String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @NotNull String yesText, @NotNull String noText, @Nullable Icon icon) {
try {
if (canShowMacSheetPanel()) {
return MacMessages.getInstance()
.showYesNoDialog(title, message, yesText, noText, WindowManager.getInstance().suggestParentWindow(project));
}
}
catch (MessageException ignored) {/*rollback the message and show a dialog*/}
catch (Exception reportThis) {LOG.error(reportThis);}
int result = showDialog(project, message, title, new String[]{yesText, noText}, 0, icon) == 0 ? YES : NO;
//noinspection ConstantConditions
LOG.assertTrue(result == YES || result == NO, result);
return result;
}
示例15: showOkCancelDialog
import com.intellij.openapi.wm.WindowManager; //导入依赖的package包/类
/**
* @return {@link #OK} if user pressed "Ok" or {@link #CANCEL} if user pressed "Cancel" button.
*/
@OkCancelResult
public static int showOkCancelDialog(Project project,
String message,
@NotNull @Nls(capitalization = Nls.Capitalization.Title) String title,
@NotNull String okText,
@NotNull String cancelText,
Icon icon,
DialogWrapper.DoNotAskOption doNotAskOption) {
try {
if (canShowMacSheetPanel()) {
int result = MacMessages.getInstance()
.showYesNoDialog(title, message, okText, cancelText, WindowManager.getInstance().suggestParentWindow(project),
doNotAskOption);
return result == YES ? OK : CANCEL;
}
}
catch (MessageException ignored) {/*rollback the message and show a dialog*/}
catch (Exception reportThis) {LOG.error(reportThis);}
return showDialog(project, message, title, new String[]{okText, cancelText}, 0, icon, doNotAskOption) == 0 ? OK : CANCEL;
}