javax.swing.plaf.basic.BasicLookAndFeel#com.intellij.openapi.util.SystemInfo源码实例Demo

下面列出了javax.swing.plaf.basic.BasicLookAndFeel#com.intellij.openapi.util.SystemInfo 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: consulo   文件: SystemHealthMonitor.java
private void checkSignalBlocking() {
  if (SystemInfo.isUnix && JnaLoader.isLoaded()) {
    try {
      LibC lib = Native.loadLibrary("c", LibC.class);
      Memory buf = new Memory(1024);
      if (lib.sigaction(LibC.SIGINT, null, buf) == 0) {
        long handler = Native.POINTER_SIZE == 8 ? buf.getLong(0) : buf.getInt(0);
        if (handler == LibC.SIG_IGN) {
          showNotification(new KeyHyperlinkAdapter("ide.sigint.ignored.message"));
        }
      }
    }
    catch (Throwable t) {
      LOG.warn(t);
    }
  }
}
 
源代码2 项目: consulo   文件: ComponentWithBrowseButton.java
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");
  }
}
 
源代码3 项目: consulo   文件: NativeFileWatcherImpl.java
/**
 * Subclasses should override this method to provide a custom binary to run.
 */
@Nullable
public static File getExecutable() {
  String execPath = System.getProperty(PROPERTY_WATCHER_EXECUTABLE_PATH);
  if (execPath != null) return new File(execPath);

  String[] names = null;
  if (SystemInfo.isWindows) {
    if ("win32-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier.exe"};
    else if ("win32-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64.exe", "fsnotifier.exe"};
  }
  else if (SystemInfo.isMac) {
    names = new String[]{"fsnotifier"};
  }
  else if (SystemInfo.isLinux) {
    if ("linux-x86".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier"};
    else if ("linux-x86-64".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier64"};
    else if ("linux-arm".equals(Platform.RESOURCE_PREFIX)) names = new String[]{"fsnotifier-arm"};
  }
  if (names == null) return PLATFORM_NOT_SUPPORTED;

  return Arrays.stream(names).map(ContainerPathManager.get()::findBinFile).filter(Objects::nonNull).findFirst().orElse(null);
}
 
源代码4 项目: consulo   文件: JBUIScale.java
private static float computeUserScaleFactor(float scale) {
  if (!SystemProperties.getBooleanProperty("hidpi", true)) {
    return 1f;
  }

  scale = discreteScale(scale);

  // Downgrading user scale below 1.0 may be uncomfortable (tiny icons),
  // whereas some users prefer font size slightly below normal which is ok.
  if (scale < 1 && sysScale() >= 1) {
    scale = 1;
  }

  // Ignore the correction when UIUtil.DEF_SYSTEM_FONT_SIZE is overridden, see UIUtil.initSystemFontData.
  if (SystemInfo.isLinux && scale == 1.25f && UIUtil.DEF_SYSTEM_FONT_SIZE == 12) {
    // Default UI font size for Unity and Gnome is 15. Scaling factor 1.25f works badly on Linux
    scale = 1f;
  }
  return scale;
}
 
源代码5 项目: consulo   文件: VMOptions.java
@Nullable
public static File getWriteFile() {
  String vmOptionsFile = System.getProperty("jb.vmOptionsFile");
  if (vmOptionsFile == null) {
    // launchers should specify a path to an options file used to configure a JVM
    return null;
  }

  vmOptionsFile = new File(vmOptionsFile).getAbsolutePath();
  if (!FileUtil.isAncestor(ContainerPathManager.get().getHomePath(), vmOptionsFile, true)) {
    // a file is located outside the IDE installation - meaning it is safe to overwrite
    return new File(vmOptionsFile);
  }

  File appHomeDirectory = ContainerPathManager.get().getAppHomeDirectory();

  String fileName = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US);
  if (SystemInfo.is64Bit && !SystemInfo.isMac) fileName += "64";
  if (SystemInfo.isWindows) fileName += ".exe";
  fileName += ".vmoptions";
  return new File(appHomeDirectory, fileName);
}
 
源代码6 项目: consulo   文件: Restarter.java
public static int scheduleRestart(@Nonnull String... beforeRestart) throws IOException {
  try {
    int restartCode = getRestartCode();
    if (restartCode != 0) {
      runCommand(beforeRestart);
      return restartCode;
    }
    else if (SystemInfo.isWindows) {
      restartOnWindows(beforeRestart);
      return 0;
    }
    else if (SystemInfo.isMac) {
      restartOnMac(beforeRestart);
      return 0;
    }
  }
  catch (Throwable t) {
    throw new IOException("Cannot restart application: " + t.getMessage(), t);
  }

  runCommand(beforeRestart);
  throw new IOException("Cannot restart application: not supported.");
}
 
源代码7 项目: consulo   文件: FileAttributesReadingTest.java
@Test
public void extraLongName() throws Exception {
  final String prefix = StringUtil.repeatSymbol('a', 128) + ".";
  final File dir = FileUtil.createTempDirectory(
    FileUtil.createTempDirectory(
      FileUtil.createTempDirectory(
        FileUtil.createTempDirectory(
          myTempDirectory, prefix, ".dir"),
        prefix, ".dir"),
      prefix, ".dir"),
    prefix, ".dir");
  final File file = FileUtil.createTempFile(dir, prefix, ".txt");
  assertTrue(file.exists());
  FileUtil.writeToFile(file, myTestData);

  assertFileAttributes(file);
  if (SystemInfo.isWindows) {
    assertDirectoriesEqual(dir);
  }

  final String target = FileSystemUtil.resolveSymLink(file);
  assertEquals(file.getPath(), target);
}
 
源代码8 项目: consulo   文件: LockSupportTest.java
@Test(timeout = 30000)
public void testUseCanonicalPathLock() throws Exception {
  Assume.assumeThat(SystemInfo.isFileSystemCaseSensitive, CoreMatchers.is(false));

  String path1 = myTempDir.getPath();
  String path2 = path1.toUpperCase(Locale.ENGLISH);

  DesktopImportantFolderLocker lock1 = new DesktopImportantFolderLocker(path1 + "/c", path1 + "/s");
  DesktopImportantFolderLocker lock2 = new DesktopImportantFolderLocker(path2 + "/c", path2 + "/s");
  try {
    lock1.lock();
    assertThat(lock2.lock(), CoreMatchers.equalTo(DesktopImportantFolderLocker.ActivateStatus.ACTIVATED));
  }
  finally {
    lock1.dispose();
    lock2.dispose();
  }
}
 
源代码9 项目: bamboo-soy   文件: RollbarErrorReportSubmitter.java
private void log(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) {
  IdeaLoggingEvent ideaEvent = events[0];
  if (ideaEvent.getThrowable() == null) {
    return;
  }
  LinkedHashMap<String, Object> customData = new LinkedHashMap<>();
  customData.put(TAG_PLATFORM_VERSION, ApplicationInfo.getInstance().getBuild().asString());
  customData.put(TAG_OS, SystemInfo.OS_NAME);
  customData.put(TAG_OS_VERSION, SystemInfo.OS_VERSION);
  customData.put(TAG_OS_ARCH, SystemInfo.OS_ARCH);
  customData.put(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION);
  customData.put(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION);
  if (additionalInfo != null) {
    customData.put(EXTRA_ADDITIONAL_INFO, additionalInfo);
  }
  if (events.length > 1) {
    customData.put(EXTRA_MORE_EVENTS,
        Stream.of(events).map(Object::toString).collect(Collectors.joining("\n")));
  }
  rollbar.codeVersion(getPluginVersion()).log(ideaEvent.getThrowable(), customData);
}
 
源代码10 项目: consulo   文件: FileUtil.java
@Nonnull
private static String normalizeTail(int prefixEnd, @Nonnull String path, boolean separator) {
  final StringBuilder result = new StringBuilder(path.length());
  result.append(path, 0, prefixEnd);
  int start = prefixEnd;
  if (start == 0 && SystemInfo.isWindows && (path.startsWith("//") || path.startsWith("\\\\"))) {
    start = 2;
    result.append("//");
    separator = true;
  }

  for (int i = start; i < path.length(); ++i) {
    final char c = path.charAt(i);
    if (c == '/' || c == '\\') {
      if (!separator) result.append('/');
      separator = true;
    }
    else {
      result.append(c);
      separator = false;
    }
  }

  return result.toString();
}
 
源代码11 项目: flutter-intellij   文件: Analytics.java
@Nullable
private static String createUserAgent() {
  final String locale = Locale.getDefault().toString();

  if (SystemInfo.isWindows) {
    return "Mozilla/5.0 (Windows; Windows; Windows; " + locale + ")";
  }
  else if (SystemInfo.isMac) {
    return "Mozilla/5.0 (Macintosh; Intel Mac OS X; Macintosh; " + locale + ")";
  }
  else if (SystemInfo.isLinux) {
    return "Mozilla/5.0 (Linux; Linux; Linux; " + locale + ")";
  }

  return null;
}
 
源代码12 项目: consulo   文件: FileAttributesReadingTest.java
@Nonnull
private static FileAttributes getAttributes(@Nonnull final File file, final boolean checkList) {
  final FileAttributes attributes = FileSystemUtil.getAttributes(file);
  assertNotNull(attributes);
  System.out.println(attributes + ": " + file);

  if (SystemInfo.isWindows && checkList) {
    final String parent = file.getParent();
    if (parent != null) {
      final FileInfo[] infos = IdeaWin32.getInstance().listChildren(parent);
      assertNotNull(infos);
      for (FileInfo info : infos) {
        if (file.getName().equals(info.getName())) {
          assertEquals(attributes, info.toFileAttributes());
          return attributes;
        }
      }
      fail(file + " not listed");
    }
  }

  return attributes;
}
 
源代码13 项目: consulo   文件: WinProcessManager.java
public static int getProcessId(Process process) {
  String processClassName = process.getClass().getName();
  if (processClassName.equals("java.lang.Win32Process") || processClassName.equals("java.lang.ProcessImpl")) {
    try {
      if (SystemInfo.IS_AT_LEAST_JAVA9) {
        //noinspection JavaReflectionMemberAccess
        return ((Long)Process.class.getMethod("pid").invoke(process)).intValue();
      }

      long handle = assertNotNull(ReflectionUtil.getField(process.getClass(), process, long.class, "handle"));
      return Kernel32.INSTANCE.GetProcessId(new WinNT.HANDLE(Pointer.createConstant(handle)));
    }
    catch (Throwable t) {
      throw new IllegalStateException("Failed to get PID from instance of " + process.getClass() + ", OS: " + SystemInfo.OS_NAME, t);
    }
  }

  throw new IllegalStateException("Unable to get PID from instance of " + process.getClass() + ", OS: " + SystemInfo.OS_NAME);
}
 
源代码14 项目: consulo   文件: MouseGestureManager.java
public void add(final IdeFrame frame) {
  if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;

  if (SystemInfo.isMacOSSnowLeopard) {
    try {
      if (myListeners.containsKey(frame)) {
        remove(frame);
      }

      Object listener = new MacGestureAdapter(this, frame);

      myListeners.put(frame, listener);
    }
    catch (Throwable e) {
      LOG.debug(e);
    }
  }
}
 
源代码15 项目: consulo   文件: NewProjectAction.java
@RequiredUIAccess
@Nonnull
@Override
protected JPanel createSouthPanel() {
  JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, SystemInfo.isMacOSLeopard ? 0 : 5, 0));

  myCancelButton = new JButton(CommonBundle.getCancelButtonText());
  myCancelButton.addActionListener(e -> doCancelAction());

  buttonsPanel.add(myCancelButton);

  myOkButton = new JButton(CommonBundle.getOkButtonText()) {
    @Override
    public boolean isDefaultButton() {
      return true;
    }
  };
  myOkButton.setEnabled(false);

  myOkButton.addActionListener(e -> doOkAction());
  buttonsPanel.add(myOkButton);

  return JBUI.Panels.simplePanel().addToRight(buttonsPanel);
}
 
源代码16 项目: consulo   文件: MinimizeCurrentWindowAction.java
@Override
public void update(final AnActionEvent e) {
  final Presentation p = e.getPresentation();
  p.setVisible(SystemInfo.isMac);

  if (SystemInfo.isMac) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
      JFrame frame = (JFrame)TargetAWT.to(WindowManager.getInstance().getWindow(project));
      if (frame != null) {
        JRootPane pane = frame.getRootPane();
        p.setEnabled(pane != null && pane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null);
      }
    }
  }
  else {
    p.setEnabled(false);
  }
}
 
@Test
public void localPathFromTfsRepresentationShouldConvertPathCase() throws IOException {
    File tempDirectory = FileUtil.createTempDirectory("azure-devops", ".tmp");
    try {
        File tempFile = tempDirectory.toPath().resolve("CASE_SENSITIVE.tmp").toFile();
        Assert.assertTrue(tempFile.createNewFile());

        String tfsRepresentation = tempFile.getAbsolutePath();
        // On non-Windows systems, TFS uses a "fake drive" prefix:
        if (!SystemInfo.isWindows)
            tfsRepresentation = "U:" + tfsRepresentation;

        String localPath = VersionControlPath.localPathFromTfsRepresentation(tfsRepresentation);
        Assert.assertEquals(tempFile.getAbsolutePath(), localPath);

        if (!SystemInfo.isFileSystemCaseSensitive) {
            tfsRepresentation = tfsRepresentation.toLowerCase();
            localPath = VersionControlPath.localPathFromTfsRepresentation(tfsRepresentation);
            Assert.assertEquals(tempFile.getAbsolutePath(), localPath);
        }
    } finally {
        FileUtil.delete(tempDirectory);
    }
}
 
源代码18 项目: consulo   文件: ToggleWindowedModeAction.java
@Override
public void update(AnActionEvent event) {
  super.update(event);
  Presentation presentation = event.getPresentation();
  if (SystemInfo.isMac) {
    presentation.setEnabledAndVisible(false);
    return;
  }
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManager mgr = ToolWindowManager.getInstance(project);
  String id = mgr.getActiveToolWindowId();
  presentation.setEnabled(id != null && mgr.getToolWindow(id).isAvailable());
}
 
源代码19 项目: dynkt   文件: PathManager.java
private static String getOSSpecificBinSubdir() {
	if (SystemInfo.isWindows) {
		return "win";
	}
	if (SystemInfo.isMac) {
		return "mac";
	}
	return "linux";
}
 
源代码20 项目: consulo   文件: NativeFileWatcherImpl.java
private void processChange(@Nonnull String path, @Nonnull WatcherOp op) {
  if (SystemInfo.isWindows && op == WatcherOp.RECDIRTY) {
    myNotificationSink.notifyReset(path);
    return;
  }

  if ((op == WatcherOp.CHANGE || op == WatcherOp.STATS) && isRepetition(path)) {
    if (LOG.isTraceEnabled()) LOG.trace("repetition: " + path);
    return;
  }

  if (SystemInfo.isMac) {
    path = Normalizer.normalize(path, Normalizer.Form.NFC);
  }

  switch (op) {
    case STATS:
    case CHANGE:
      myNotificationSink.notifyDirtyPath(path);
      break;

    case CREATE:
    case DELETE:
      myNotificationSink.notifyPathCreatedOrDeleted(path);
      break;

    case DIRTY:
      myNotificationSink.notifyDirtyDirectory(path);
      break;

    case RECDIRTY:
      myNotificationSink.notifyDirtyPathRecursive(path);
      break;

    default:
      LOG.error("Unexpected op: " + op);
  }
}
 
源代码21 项目: consulo   文件: JreHiDpiUtil.java
/**
 * Returns whether the JRE-managed HiDPI mode is enabled.
 * (True for macOS JDK >= 7.10 versions)
 *
 * @see ScaleType
 */
public static boolean isJreHiDPIEnabled() {
  Boolean value = jreHiDPI.get();
  if (value == null) {
    synchronized (jreHiDPI) {
      value = jreHiDPI.get();
      if (value == null) {
        value = false;
        if (SystemProperties.getBooleanProperty("hidpi", true)) {
          jreHiDPI_earlierVersion = true;
          // fixme [vistall] always allow hidpi on other jdks
          if (Boolean.TRUE) {
            try {
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              Boolean uiScaleEnabled = GraphicsEnvironmentHacking.isUIScaleEnabled(ge);
              if (uiScaleEnabled != null) {
                value = uiScaleEnabled;
                jreHiDPI_earlierVersion = false;
              }
            }
            catch (Throwable ignore) {
            }
          }
          if (SystemInfo.isMac) {
            value = true;
          }
        }
        jreHiDPI.set(value);
      }
    }
  }
  return value;
}
 
源代码22 项目: consulo   文件: JnaUnixMediatorImpl.java
JnaUnixMediatorImpl() throws Exception {
  if (SystemInfo.isLinux) {
    if ("arm".equals(SystemInfo.OS_ARCH)) {
      if (SystemInfo.is32Bit) {
        myOffsets = LINUX_ARM;
      }
      else {
        throw new IllegalStateException("AArch64 architecture is not supported");
      }
    }
    else if ("ppc".equals(SystemInfo.OS_ARCH)) {
      myOffsets = SystemInfo.is32Bit ? LNX_PPC32 : LNX_PPC64;
    }
    else {
      myOffsets = SystemInfo.is32Bit ? LINUX_32 : LINUX_64;
    }
  }
  else if (SystemInfo.isMac | SystemInfo.isFreeBSD) {
    myOffsets = SystemInfo.is32Bit ? BSD_32 : BSD_64;
  }
  else if (SystemInfo.isSolaris) {
    myOffsets = SystemInfo.is32Bit ? SUN_OS_32 : SUN_OS_64;
  }
  else {
    throw new IllegalStateException("Unsupported OS/arch: " + SystemInfo.OS_NAME + "/" + SystemInfo.OS_ARCH);
  }

  myLibC = (LibC)Native.loadLibrary("c", LibC.class);
  myUid = myLibC.getuid();
  myGid = myLibC.getgid();
}
 
源代码23 项目: consulo   文件: OrderEntryAppearanceServiceImpl.java
@Nonnull
@Override
public CellAppearanceEx forSdk(@Nullable final Sdk jdk, final boolean isInComboBox, final boolean selected, final boolean showVersion) {
  if (jdk == null) {
    return SimpleTextCellAppearance.invalid(ProjectBundle.message("unknown.sdk"), AllIcons.Toolbar.Unknown);
  }

  String name = jdk.getName();
  CompositeAppearance appearance = new CompositeAppearance();
  SdkType sdkType = (SdkType)jdk.getSdkType();
  appearance.setIcon(SdkUtil.getIcon(jdk));
  SimpleTextAttributes attributes = getTextAttributes(sdkType.sdkHasValidPath(jdk), selected);
  CompositeAppearance.DequeEnd ending = appearance.getEnding();
  ending.addText(name, attributes);

  if (showVersion) {
    String versionString = jdk.getVersionString();
    if (versionString != null && !versionString.equals(name)) {
      SimpleTextAttributes textAttributes = isInComboBox && !selected ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES :
                                            SystemInfo.isMac && selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, 
                                                                                                    Color.WHITE): SimpleTextAttributes.GRAY_ATTRIBUTES;
      ending.addComment(versionString, textAttributes);
    }
  }

  return ending.getAppearance();
}
 
@Override
public void setupCompiler(@Nonnull DotNetModuleExtension<?> netExtension,
		@Nonnull CSharpModuleExtension<?> csharpExtension,
		@Nonnull MSBaseDotNetCompilerOptionsBuilder builder,
		@Nullable VirtualFile compilerSdkHome) throws DotNetCompileFailedException
{
	Sdk sdk = netExtension.getSdk();
	if(sdk == null)
	{
		throw new DotNetCompileFailedException("Mono SDK is not resolved");
	}

	if(SystemInfo.isWindows)
	{
		builder.setExecutableFromSdk(sdk, "/../../../bin/mcs.bat");
	}
	else if(SystemInfo.isMac)
	{
		builder.setExecutableFromSdk(sdk, "/../../../bin/mcs");
	}
	else if(SystemInfo.isFreeBSD)
	{
		builder.setExecutable(MonoSdkType.ourDefaultFreeBSDCompilerPath);
	}
	else if(SystemInfo.isLinux)
	{
		builder.setExecutable(MonoSdkType.ourDefaultLinuxCompilerPath);
	}
}
 
源代码25 项目: dark-mode-sync-plugin   文件: DarkModeSync.java
/** @param lafManager IDEA look-and-feel manager for getting and setting the current theme */
public DarkModeSync(final LafManager lafManager) {
  themes = ServiceManager.getService(DarkModeSyncThemes.class);
  this.lafManager = lafManager;
  // Checks if OS is Windows or MacOS
  if (!(SystemInfo.isMacOSMojave || SystemInfo.isWin10OrNewer)) {
    logger.error("Plugin only supports macOS Mojave and greater or Windows 10 and greater");
    scheduledFuture = null;
    return;
  }
  ScheduledExecutorService executor = JobScheduler.getScheduler();
  scheduledFuture =
      executor.scheduleWithFixedDelay(this::updateLafIfNecessary, 0, 3, TimeUnit.SECONDS);
}
 
源代码26 项目: consulo   文件: LafManagerImpl.java
/**
 * The following code is a trick! By default Swing uses lightweight and "medium" weight
 * popups to show JPopupMenu. The code below force the creation of real heavyweight menus -
 * this increases speed of popups and allows to get rid of some drawing artifacts.
 */
private static void fixPopupWeight() {
  int popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
  String property = System.getProperty("idea.popup.weight");
  if (property != null) property = property.toLowerCase().trim();
  if (SystemInfo.isMacOSLeopard) {
    // force heavy weight popups under Leopard, otherwise they don't have shadow or any kind of border.
    popupWeight = OurPopupFactory.WEIGHT_HEAVY;
  }
  else if (property == null) {
    // use defaults if popup weight isn't specified
    if (SystemInfo.isWindows) {
      popupWeight = OurPopupFactory.WEIGHT_HEAVY;
    }
  }
  else {
    if ("light".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_LIGHT;
    }
    else if ("medium".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
    }
    else if ("heavy".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_HEAVY;
    }
    else {
      LOG.error("Illegal value of property \"idea.popup.weight\": " + property);
    }
  }

  PopupFactory factory = PopupFactory.getSharedInstance();
  if (!(factory instanceof OurPopupFactory)) {
    factory = new OurPopupFactory(factory);
    PopupFactory.setSharedInstance(factory);
  }
  PopupUtil.setPopupType(factory, popupWeight);
}
 
源代码27 项目: consulo   文件: FileAttributesReadingTest.java
@Test
public void special() throws Exception {
  assumeTrue(SystemInfo.isUnix);
  final File file = new File("/dev/null");

  final FileAttributes attributes = getAttributes(file);
  assertEquals(FileAttributes.Type.SPECIAL, attributes.type);
  assertEquals(0, attributes.flags);
  assertEquals(0, attributes.length);
  assertTrue(attributes.isWritable());

  final String target = FileSystemUtil.resolveSymLink(file);
  assertEquals(file.getPath(), target);
}
 
源代码28 项目: consulo   文件: Messages.java
@Override
public void show() {
  if (isMacSheetEmulation()) {
    setInitialLocationCallback(new Computable<Point>() {
      @Override
      public Point compute() {
        JRootPane rootPane = SwingUtilities.getRootPane(getWindow().getParent());
        if (rootPane == null) {
          rootPane = SwingUtilities.getRootPane(getWindow().getOwner());
        }

        Point p = rootPane.getLocationOnScreen();
        p.x += (rootPane.getWidth() - getWindow().getWidth()) / 2;
        return p;
      }
    });
    animate();
    if (SystemInfo.isJavaVersionAtLeast(7, 0, 0)) {
      try {
        Method method = Class.forName("java.awt.Window").getDeclaredMethod("setOpacity", float.class);
        if (method != null) method.invoke(getPeer().getWindow(), .8f);
      }
      catch (Exception exception) {
      }
    }
    setAutoAdjustable(false);
    setSize(getPreferredSize().width, 0);//initial state before animation, zero height
  }
  super.show();
}
 
源代码29 项目: consulo   文件: LafManagerImpl.java
private static void fixGtkPopupStyle() {
  if (!UIUtil.isUnderGTKLookAndFeel()) return;

  // it must be instance of com.sun.java.swing.plaf.gtk.GTKStyleFactory, but class package-local
  if (SystemInfo.isJavaVersionAtLeast(10, 0, 0)) {
    return;
  }

  final SynthStyleFactory original = SynthLookAndFeel.getStyleFactory();

  SynthLookAndFeel.setStyleFactory(new SynthStyleFactory() {
    @Override
    public SynthStyle getStyle(final JComponent c, final Region id) {
      final SynthStyle style = original.getStyle(c, id);
      if (id == Region.POPUP_MENU) {
        final Integer x = ReflectionUtil.getField(style.getClass(), style, int.class, "xThickness");
        if (x != null && x == 0) {
          // workaround for Sun bug #6636964
          ReflectionUtil.setField(style.getClass(), style, int.class, "xThickness", 1);
          ReflectionUtil.setField(style.getClass(), style, int.class, "yThickness", 3);
        }
      }
      return style;
    }
  });

  new JBPopupMenu();  // invokes updateUI() -> updateStyle()

  SynthLookAndFeel.setStyleFactory(original);
}
 
源代码30 项目: react-native-console   文件: NotificationUtils.java
/**
 * python提示
 */
public static void pythonNotFound() {
    String tip = "command 'python' not found. ";
    if (SystemInfo.isWindows) {
        tip += "  if first installation python or Set Environment variable, Please restart your computer";
    }
    errorNotification(tip);
}