本文整理汇总了Java中com.intellij.ui.UIBundle类的典型用法代码示例。如果您正苦于以下问题:Java UIBundle类的具体用法?Java UIBundle怎么用?Java UIBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIBundle类属于com.intellij.ui包,在下文中一共展示了UIBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComponentWithBrowseButton
import com.intellij.ui.UIBundle; //导入依赖的package包/类
public ComponentWithBrowseButton(Comp component, @Nullable ActionListener browseActionListener) {
super(new BorderLayout(SystemInfo.isMac ? 0 : 2, 0));
myComponent = component;
// required! otherwise JPanel will occasionally gain focus instead of the component
setFocusable(false);
add(myComponent, BorderLayout.CENTER);
myBrowseButton = new FixedSizeButton(myComponent);
if (browseActionListener != null) {
myBrowseButton.addActionListener(browseActionListener);
}
// don't force FixedSizeButton to occupy the whole height
add(wrapWithoutResize(myBrowseButton), BorderLayout.EAST);
myBrowseButton.setToolTipText(UIBundle.message("component.with.browse.button.browse.button.tooltip.text"));
// FixedSizeButton isn't focusable but it should be selectable via keyboard.
if (ApplicationManager.getApplication() != null) { // avoid crash at design time
new MyDoClickAction(myBrowseButton).registerShortcut(myComponent);
}
}
示例2: updateState
import com.intellij.ui.UIBundle; //导入依赖的package包/类
private void updateState() {
if (!isShowing()) {
return;
}
final Runtime runtime = Runtime.getRuntime();
final long total = runtime.totalMemory() / MEGABYTE;
final long used = total - runtime.freeMemory() / MEGABYTE;
if (total != myLastTotal || used != myLastUsed) {
myLastTotal = total;
myLastUsed = used;
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
public void run() {
myBufferedImage = null;
repaint();
}
});
setToolTipText(UIBundle.message("memory.usage.panel.statistics.message", total, used));
}
}
示例3: addNotify
import com.intellij.ui.UIBundle; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
final String key = "toolwindow.stripes.buttons.info.shown";
if (UISettings.getInstance().HIDE_TOOL_STRIPES && !PropertiesComponent.getInstance().isTrueValue(key)) {
PropertiesComponent.getInstance().setValue(key, String.valueOf(true));
final Alarm alarm = new Alarm();
alarm.addRequest(new Runnable() {
@Override
public void run() {
GotItMessage.createMessage(UIBundle.message("tool.window.quick.access.title"), UIBundle.message(
"tool.window.quick.access.message"))
.setDisposable(ToolWindowsWidget.this)
.show(new RelativePoint(ToolWindowsWidget.this, new Point(10, 0)), Balloon.Position.above);
Disposer.dispose(alarm);
}
}, 20000);
}
}
示例4: getClickConsumer
import com.intellij.ui.UIBundle; //导入依赖的package包/类
public Consumer<MouseEvent> getClickConsumer() {
return new Consumer<MouseEvent>() {
public void consume(MouseEvent mouseEvent) {
final VirtualFile file = getCurrentFile();
if (!isReadOnlyApplicableForFile(file)) {
return;
}
FileDocumentManager.getInstance().saveAllDocuments();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
try {
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, file.isWritable());
myStatusBar.updateWidget(ID());
}
catch (IOException e) {
Messages.showMessageDialog(getProject(), e.getMessage(), UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
}
}
});
}
};
}
示例5: getClickConsumer
import com.intellij.ui.UIBundle; //导入依赖的package包/类
public Consumer<MouseEvent> getClickConsumer() {
return new Consumer<MouseEvent>() {
public void consume(MouseEvent mouseEvent) {
final Project project = getProject();
if (project == null) return;
final Editor editor = getEditor();
if (editor == null) return;
final CommandProcessor processor = CommandProcessor.getInstance();
processor.executeCommand(
project, new Runnable() {
public void run() {
final GotoLineNumberDialog dialog = new GotoLineNumberDialog(project, editor);
dialog.show();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
}
},
UIBundle.message("go.to.line.command.name"),
null
);
}
};
}
示例6: createFileNamePanel
import com.intellij.ui.UIBundle; //导入依赖的package包/类
protected JComponent createFileNamePanel() {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST);
myFileName.setText("");
myFileName.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
updateOkButton();
}
});
panel.add(myFileName, BorderLayout.CENTER);
if (myExtensions.getModel().getSize() > 0) {
myExtensions.setSelectedIndex(0);
panel.add(myExtensions, BorderLayout.EAST);
}
return panel;
}
示例7: createNewFile
import com.intellij.ui.UIBundle; //导入依赖的package包/类
private static void createNewFile(FileSystemTree fileSystemTree, final FileType fileType, final String initialContent) {
final VirtualFile file = fileSystemTree.getNewFileParent();
if (file == null || !file.isDirectory()) return;
String newFileName;
while (true) {
newFileName = Messages.showInputDialog(UIBundle.message("create.new.file.enter.new.file.name.prompt.text"),
UIBundle.message("new.file.dialog.title"), Messages.getQuestionIcon());
if (newFileName == null) {
return;
}
if ("".equals(newFileName.trim())) {
Messages.showMessageDialog(UIBundle.message("create.new.file.file.name.cannot.be.empty.error.message"),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFile(file, newFileName, fileType, initialContent);
if (failReason != null) {
Messages.showMessageDialog(UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
return;
}
}
示例8: createNewFolder
import com.intellij.ui.UIBundle; //导入依赖的package包/类
private static void createNewFolder(FileSystemTree fileSystemTree) {
final VirtualFile file = fileSystemTree.getNewFileParent();
if (file == null || !file.isDirectory()) return;
final InputValidatorEx validator = new NewFolderValidator(file);
final String newFolderName = Messages.showInputDialog(UIBundle.message("create.new.folder.enter.new.folder.name.prompt.text"),
UIBundle.message("new.folder.dialog.title"), Messages.getQuestionIcon(),
"", validator);
if (newFolderName == null) {
return;
}
Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFolder(file, newFolderName);
if (failReason != null) {
Messages.showMessageDialog(UIBundle.message("create.new.folder.could.not.create.folder.error.message", newFolderName),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
}
}
示例9: ComponentWithBrowseButton
import com.intellij.ui.UIBundle; //导入依赖的package包/类
public ComponentWithBrowseButton(Comp component, @Nullable ActionListener browseActionListener) {
super(new BorderLayout(SystemInfo.isMac? 0 : 2, 0));
myComponent = component;
// required! otherwise JPanel will occasionally gain focus instead of the component
setFocusable(false);
add(myComponent, BorderLayout.CENTER);
myBrowseButton=new FixedSizeButton(myComponent);
if (browseActionListener != null)
myBrowseButton.addActionListener(browseActionListener);
add(myBrowseButton, BorderLayout.EAST);
myBrowseButton.setToolTipText(UIBundle.message("component.with.browse.button.browse.button.tooltip.text"));
// FixedSizeButton isn't focusable but it should be selectable via keyboard.
if (ApplicationManager.getApplication() != null) { // avoid crash at design time
new MyDoClickAction(myBrowseButton).registerShortcut(myComponent);
}
}
示例10: createFileNamePanel
import com.intellij.ui.UIBundle; //导入依赖的package包/类
protected JComponent createFileNamePanel() {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST);
myFileName.setText("");
myFileName.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
updateOkButton();
}
});
panel.add(myFileName, BorderLayout.CENTER);
if (myExtensions.getModel().getSize() > 0) {
myExtensions.setSelectedIndex(0);
panel.add(myExtensions, BorderLayout.EAST);
}
return panel;
}
示例11: createNewFolder
import com.intellij.ui.UIBundle; //导入依赖的package包/类
private static void createNewFolder(FileSystemTree fileSystemTree) {
final VirtualFile file = fileSystemTree.getNewFileParent();
if (file == null || !file.isDirectory()) return;
String newFolderName;
while (true) {
newFolderName = Messages.showInputDialog(UIBundle.message("create.new.folder.enter.new.folder.name.prompt.text"),
UIBundle.message("new.folder.dialog.title"), Messages.getQuestionIcon());
if (newFolderName == null) {
return;
}
if ("".equals(newFolderName.trim())) {
Messages.showMessageDialog(UIBundle.message("create.new.folder.folder.name.cannot.be.empty.error.message"),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFolder(file, newFolderName);
if (failReason != null) {
Messages.showMessageDialog(UIBundle.message("create.new.folder.could.not.create.folder.error.message", newFolderName),
UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
continue;
}
return;
}
}
示例12: ComponentWithBrowseButton
import com.intellij.ui.UIBundle; //导入依赖的package包/类
public ComponentWithBrowseButton(Comp component, @Nullable ActionListener browseActionListener) {
super(new BorderLayout(SystemInfo.isMac ? 0 : 2, 0));
myComponent = component;
// required! otherwise JPanel will occasionally gain focus instead of the component
setFocusable(false);
add(myComponent, BorderLayout.CENTER);
myBrowseButton = new FixedSizeButton(myComponent);
if (browseActionListener != null) {
myBrowseButton.addActionListener(browseActionListener);
}
add(centerComponentVertically(myBrowseButton), BorderLayout.EAST);
myBrowseButton.setToolTipText(UIBundle.message("component.with.browse.button.browse.button.tooltip.text"));
// FixedSizeButton isn't focusable but it should be selectable via keyboard.
if (ApplicationManager.getApplication() != null) { // avoid crash at design time
new MyDoClickAction(myBrowseButton).registerShortcut(myComponent);
}
if (ScreenReader.isActive()) {
myBrowseButton.setFocusable(true);
myBrowseButton.getAccessibleContext().setAccessibleName("Browse");
}
}
示例13: updateState
import com.intellij.ui.UIBundle; //导入依赖的package包/类
private void updateState() {
if (!isShowing()) {
return;
}
final Runtime runtime = Runtime.getRuntime();
final long total = runtime.totalMemory() / MEGABYTE;
final long used = total - runtime.freeMemory() / MEGABYTE;
if (total != myLastTotal || used != myLastUsed) {
myLastTotal = total;
myLastUsed = used;
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
myBufferedImage = null;
repaint();
}
});
setToolTipText(UIBundle.message("memory.usage.panel.statistics.message", total, used));
}
}
示例14: getClickConsumer
import com.intellij.ui.UIBundle; //导入依赖的package包/类
@Override
public Consumer<MouseEvent> getClickConsumer() {
return mouseEvent -> {
final VirtualFile file = getCurrentFile();
if (!isReadOnlyApplicableForFile(file)) {
return;
}
FileDocumentManager.getInstance().saveAllDocuments();
try {
WriteAction.run(() -> ReadOnlyAttributeUtil.setReadOnlyAttribute(file, file.isWritable()));
myStatusBar.updateWidget(ID());
}
catch (IOException e) {
Messages.showMessageDialog(getProject(), e.getMessage(), UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
}
};
}
示例15: getClickConsumer
import com.intellij.ui.UIBundle; //导入依赖的package包/类
@Override
public Consumer<MouseEvent> getClickConsumer() {
return mouseEvent -> {
final Project project = getProject();
if (project == null) return;
final Editor editor = getEditor();
if (editor == null) return;
final CommandProcessor processor = CommandProcessor.getInstance();
processor.executeCommand(
project, () -> {
final GotoLineNumberDialog dialog = new GotoLineNumberDialog(project, editor);
dialog.show();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
},
UIBundle.message("go.to.line.command.name"),
null
);
};
}