本文整理汇总了Java中org.intellij.lang.annotations.JdkConstants类的典型用法代码示例。如果您正苦于以下问题:Java JdkConstants类的具体用法?Java JdkConstants怎么用?Java JdkConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JdkConstants类属于org.intellij.lang.annotations包,在下文中一共展示了JdkConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawCharsCached
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
private void drawCharsCached(@NotNull Graphics g,
CharSequence data,
int start,
int end,
int x,
int y,
@JdkConstants.FontStyle int fontType,
Color color,
boolean drawWhitespace) {
FontInfo fnt = EditorUtil.fontForChar(data.charAt(start), fontType, this);
if (myLastCache != null && spacesOnly(data, start, end) && fnt.charWidth(' ') == myLastCache.spaceWidth) {
// we don't care about font if we only need to paint spaces and space width matches
myLastCache.addContent(g, data, start, end, x, y, null, drawWhitespace);
}
else {
drawCharsCached(g, data, start, end, x, y, fnt, color, drawWhitespace);
}
}
示例2: getFontMetrics
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
@NotNull
public FontMetrics getFontMetrics(@JdkConstants.FontStyle int fontType) {
if (myPlainFontMetrics == null) {
assertIsDispatchThread();
myPlainFontMetrics = myEditorComponent.getFontMetrics(myScheme.getFont(EditorFontType.PLAIN));
myBoldFontMetrics = myEditorComponent.getFontMetrics(myScheme.getFont(EditorFontType.BOLD));
myItalicFontMetrics = myEditorComponent.getFontMetrics(myScheme.getFont(EditorFontType.ITALIC));
myBoldItalicFontMetrics = myEditorComponent.getFontMetrics(myScheme.getFont(EditorFontType.BOLD_ITALIC));
}
if (fontType == Font.PLAIN) return myPlainFontMetrics;
if (fontType == Font.BOLD) return myBoldFontMetrics;
if (fontType == Font.ITALIC) return myItalicFontMetrics;
if (fontType == (Font.BOLD | Font.ITALIC)) return myBoldItalicFontMetrics;
LOG.error("Unknown font type: " + fontType);
return myPlainFontMetrics;
}
示例3: getTextSegmentWidth
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
private int getTextSegmentWidth(@NotNull CharSequence text,
int start,
int end,
int xStart,
@JdkConstants.FontStyle int fontType,
@NotNull Rectangle clip) {
int x = xStart;
for (int i = start; i < end && xStart < clip.x + clip.width; i++) {
char c = text.charAt(i);
if (c == '\t') {
x = EditorUtil.nextTabStop(x, this);
}
else {
x += EditorUtil.charWidth(c, fontType, this);
}
if (x > clip.x + clip.width) {
break;
}
}
return x - xStart;
}
示例4: SelectCvsElementStep
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
public SelectCvsElementStep(String title, CvsWizard wizard,
Project project,
SelectCVSConfigurationStep selectCVSConfigurationStep,
boolean allowRootSelection,
@JdkConstants.TreeSelectionMode int selectionMode,
boolean showModules,
boolean showFiles) {
super(title, wizard);
myShowModules = showModules;
mySelectCVSConfigurationStep = selectCVSConfigurationStep;
myProject = project;
myShowFiles = showFiles;
mySelectionMode = selectionMode;
myAllowRootSelection = allowRootSelection;
init();
}
示例5: mapOldModifiers
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
@JdkConstants.InputEventMask
private static int mapOldModifiers(@JdkConstants.InputEventMask int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_MASK) != 0) {
modifiers |= InputEvent.ALT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
}
if ((modifiers & InputEvent.CTRL_MASK) != 0) {
modifiers |= InputEvent.CTRL_DOWN_MASK;
}
if ((modifiers & InputEvent.META_MASK) != 0) {
modifiers |= InputEvent.META_DOWN_MASK;
}
modifiers &= InputEvent.SHIFT_DOWN_MASK
| InputEvent.ALT_DOWN_MASK
| InputEvent.ALT_GRAPH_DOWN_MASK
| InputEvent.CTRL_DOWN_MASK
| InputEvent.META_DOWN_MASK;
return modifiers;
}
示例6: areAllModifiersPressed
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
public static boolean areAllModifiersPressed(@JdkConstants.InputEventMask int modifiers, Set<Integer> modifierCodes) {
int mask = 0;
for (Integer each : modifierCodes) {
if (each == KeyEvent.VK_SHIFT) {
mask |= InputEvent.SHIFT_MASK;
}
if (each == KeyEvent.VK_CONTROL) {
mask |= InputEvent.CTRL_MASK;
}
if (each == KeyEvent.VK_META) {
mask |= InputEvent.META_MASK;
}
if (each == KeyEvent.VK_ALT) {
mask |= InputEvent.ALT_MASK;
}
}
return (modifiers ^ mask) == 0;
}
示例7: getModifierMask
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
@JdkConstants.InputEventMask
int getModifierMask(Set<String> codeTexts) {
int mask = 0;
for (String each : codeTexts) {
if ("control".equals(each)) {
mask |= InputEvent.CTRL_MASK;
}
else if ("shift".equals(each)) {
mask |= InputEvent.SHIFT_MASK;
}
else if ("alt".equals(each)) {
mask |= InputEvent.ALT_MASK;
}
else if ("meta".equals(each)) {
mask |= InputEvent.META_MASK;
}
}
return mask;
}
示例8: findScrollBar
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
@Nullable
private static JScrollBar findScrollBar(JComponent c, @JdkConstants.AdjustableOrientation int orientation) {
if (c == null) return null;
if (c instanceof JScrollBar && ((JScrollBar)c).getOrientation() == orientation) {
return (JScrollBar)c;
}
for (Component comp : c.getComponents()) {
if (comp instanceof JComponent) {
final JScrollBar scrollBar = findScrollBar((JComponent)comp, orientation);
if (scrollBar != null) {
return scrollBar;
}
}
}
return null;
}
示例9: charToVisibleWidth
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
/**
* Allows to answer how much width requires given char to be represented on a screen.
*
* @param c target character
* @param fontType font type to use for representation of the given character
* @param currentX current <code>'x'</code> position on a line where given character should be displayed
* @return width required to represent given char with the given settings on a screen;
* <code>'0'</code> if given char is a line break
*/
private int charToVisibleWidth(char c, @JdkConstants.FontStyle int fontType, int currentX) {
if (c == '\n') {
return 0;
}
if (c == '\t') {
return EditorUtil.nextTabStop(currentX, this) - currentX;
}
return EditorUtil.charWidth(c, fontType, this);
}
示例10: paintSelectionOnSecondSoftWrapLineIfNecessary
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
/**
* End user is allowed to perform selection by visual coordinates (e.g. by dragging mouse with left button hold). There is a possible
* case that such a move intersects with soft wrap introduced virtual space. We want to draw corresponding selection background
* there then.
* <p/>
* This method encapsulates functionality of drawing selection background on the second soft wrap line (e.g. on a visual line after
* the one where it is applied).
*
* @param g graphics to draw on
* @param position current position (assumed to be position of soft wrap appliance)
* @param clip target drawing area boundaries
* @param defaultBackground default background
* @param fontType current font type
* @param softWrap target soft wrap which second line virtual space may contain selection
*/
private void paintSelectionOnSecondSoftWrapLineIfNecessary(@NotNull Graphics g,
@NotNull Point position,
@NotNull Rectangle clip,
@NotNull Color defaultBackground,
@JdkConstants.FontStyle int fontType,
@NotNull SoftWrap softWrap) {
// There is a possible case that the user performed selection at soft wrap virtual space. We need to paint corresponding background
// there then.
VisualPosition selectionStartPosition = getSelectionStartPositionForPaint();
VisualPosition selectionEndPosition = getSelectionEndPositionForPaint();
if (selectionStartPosition.equals(selectionEndPosition)) {
return;
}
int currentVisualLine = position.y / getLineHeight();
// Check if the second soft wrap line is within the visual selection.
if (currentVisualLine < selectionStartPosition.line || currentVisualLine > selectionEndPosition.line
|| currentVisualLine == selectionStartPosition.line && selectionStartPosition.column >= softWrap.getIndentInColumns()) {
return;
}
// Adjust 'x' if selection starts at soft wrap virtual space.
if (selectionStartPosition.line == currentVisualLine && selectionStartPosition.column > 0) {
position.x += selectionStartPosition.column * EditorUtil.getSpaceWidth(fontType, this);
}
// Calculate selection width.
final int width;
if (selectionEndPosition.line > currentVisualLine || selectionEndPosition.column >= softWrap.getIndentInColumns()) {
width = softWrap.getIndentInPixels() - position.x;
}
else {
width = selectionEndPosition.column * EditorUtil.getSpaceWidth(fontType, this) - position.x;
}
drawBackground(g, getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR), width, position, defaultBackground, clip);
}
示例11: drawBackground
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
private int drawBackground(@NotNull Graphics g,
Color backColor,
@NotNull CharSequence text,
int start,
int end,
@NotNull Point position,
@JdkConstants.FontStyle int fontType,
@NotNull Color defaultBackground,
@NotNull Rectangle clip) {
int width = getTextSegmentWidth(text, start, end, position.x, fontType, clip);
return drawBackground(g, backColor, width, position, defaultBackground, clip);
}
示例12: drawStringWithSoftWraps
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
private int drawStringWithSoftWraps(@NotNull Graphics g,
@NotNull final String text,
@NotNull Point position,
@NotNull Rectangle clip,
Color effectColor,
EffectType effectType,
@JdkConstants.FontStyle int fontType,
Color fontColor,
int startDrawingOffset,
WhitespacePaintingStrategy context) {
return drawStringWithSoftWraps(g, text, 0, text.length(), position, clip, effectColor, effectType,
fontType, fontColor, startDrawingOffset, context);
}
示例13: charToVisibleWidth
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
/**
* Allows to answer how much width requires given char to be represented on a screen.
*
* @param c target character
* @param fontType font type to use for representation of the given character
* @param currentX current <code>'x'</code> position on a line where given character should be displayed
* @return width required to represent given char with the given settings on a screen;
* <code>'0'</code> if given char is a line break
*/
private int charToVisibleWidth(char c, @JdkConstants.FontStyle int fontType, int currentX) {
if (c == '\n') {
return 0;
}
if (c == '\t') {
return EditorUtil.nextTabStop(currentX, this) - currentX;
}
return EditorUtil.charWidth(c, fontType, this);
}
示例14: getModifiersText
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
public static String getModifiersText(@JdkConstants.InputEventMask int modifiers) {
StringBuilder buf = new StringBuilder();
if ((modifiers & InputEvent.CTRL_MASK) != 0) buf.append(CONTROL);
if ((modifiers & InputEvent.ALT_MASK) != 0) buf.append(OPTION);
if ((modifiers & InputEvent.SHIFT_MASK) != 0) buf.append(SHIFT);
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) buf.append(Toolkit.getProperty("AWT.altGraph", "Alt Graph"));
if ((modifiers & InputEvent.BUTTON1_MASK) != 0) buf.append(Toolkit.getProperty("AWT.button1", "Button1"));
if ((modifiers & InputEvent.META_MASK) != 0) buf.append(COMMAND);
return buf.toString();
}
示例15: getPatternCompileFlags
import org.intellij.lang.annotations.JdkConstants; //导入依赖的package包/类
@JdkConstants.PatternFlags
static int getPatternCompileFlags(@NotNull String regex) {
for (char c : regex.toCharArray()) {
if (Character.isUpperCase(c)) {
return 0;
}
}
return Pattern.CASE_INSENSITIVE;
}