当前位置: 首页>>代码示例>>Java>>正文


Java GuiUtils类代码示例

本文整理汇总了Java中com.intellij.ui.GuiUtils的典型用法代码示例。如果您正苦于以下问题:Java GuiUtils类的具体用法?Java GuiUtils怎么用?Java GuiUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GuiUtils类属于com.intellij.ui包,在下文中一共展示了GuiUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLogFileChooser

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
private void createLogFileChooser() {
  myLogFile = new TextFieldWithHistory();
  JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
      FileChooser.chooseFiles(descriptor, myProject, null, new Consumer<List<VirtualFile>>() {
        @Override
        public void consume(List<VirtualFile> files) {
          myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()));
        }
      });
    }
  });
  myLogFileChooserPanel.setLayout(new BorderLayout());
  myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UnscrambleDialog.java

示例2: runOrInvokeAndWait

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
private static int runOrInvokeAndWait(@NotNull final Computable<Integer> f) {
  final int[] answer = new int[1];
  try {
    GuiUtils.runOrInvokeAndWait(new Runnable() {
      @Override
      public void run() {
        answer[0] = f.compute();
      }
    });
  }
  catch (Exception e) {
    answer[0] = 0;
  }

  return answer[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:UsageLimitUtil.java

示例3: processTimeoutInEDT

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
protected int processTimeoutInEDT() {
  final int[] retcode = new int[1];

  try {
    GuiUtils.runOrInvokeAndWait(new Runnable() {
      public void run() {
        retcode[0] = processTimeout();
      }
    });
  }
  catch (Exception e) {
    throw new RuntimeException(e);
  }

  return retcode[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InterruptibleActivity.java

示例4: createDefaultRenderers

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Override
protected void createDefaultRenderers() {
  super.createDefaultRenderers();

  UIDefaults.LazyValue booleanRenderer = new UIDefaults.LazyValue() {
    @Override
    public Object createValue(@NotNull UIDefaults table) {
      DefaultCellEditor editor = new DefaultCellEditor(GuiUtils.createUndoableTextField());
      editor.setClickCountToStart(1);
      return new BooleanTableCellRenderer();
    }
  };
  //noinspection unchecked
  defaultRenderersByColumnClass.put(boolean.class, booleanRenderer);
  //noinspection unchecked
  defaultRenderersByColumnClass.put(Boolean.class, booleanRenderer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TableView.java

示例5: createDefaultEditors

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Override
protected void createDefaultEditors() {
  super.createDefaultEditors();

  //noinspection unchecked
  defaultEditorsByColumnClass.put(String.class, new UIDefaults.LazyValue() {
    @Override
    public Object createValue(@NotNull UIDefaults table) {
      DefaultCellEditor editor = new DefaultCellEditor(GuiUtils.createUndoableTextField());
      editor.setClickCountToStart(1);
      return editor;
    }
  });

  //noinspection unchecked
  defaultEditorsByColumnClass.put(boolean.class, defaultEditorsByColumnClass.get(Boolean.class));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TableView.java

示例6: testDeleteDirRecursively

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Test
public void testDeleteDirRecursively() throws Exception {
  GuiUtils.runOrInvokeAndWait(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final VirtualFile dir = myProjectRoot.findChild("dir");
          myDirtyScope.addDirtyDirRecursively(VcsUtil.getFilePath(dir));
          FileUtil.delete(VfsUtilCore.virtualToIoFile(dir));
        }
      });
    }
  });
  assertChanges(new VirtualFile[] { dir_ctxt, subdir_dtxt },
                new FileStatus[] { DELETED, DELETED });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitChangeProviderVersionedTest.java

示例7: createLogFileChooser

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
private void createLogFileChooser() {
  myLogFile = new TextFieldWithHistory();
  JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
      FileChooser.chooseFiles(descriptor, myProject, null, new Consumer<List<VirtualFile>>() {
        @Override
        public void consume(List<VirtualFile> files) {
          myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()));
        }
      });
    }
  });
  myLogFileChooserPanel.setLayout(new BorderLayout());
  myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:UnscrambleDialog.java

示例8: runOrInvokeAndWait

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
private static int runOrInvokeAndWait(final Computable<Integer> f) {
  final int[] answer = new int[1];
  try {
    GuiUtils.runOrInvokeAndWait(new Runnable() {
      @Override
      public void run() {
        answer[0] = f.compute();
      }
    });
  }
  catch (Exception e) {
    answer[0] = 0;
  }

  return answer[0];
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:UsageLimitUtil.java

示例9: execute

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Override
public RunResult<T> execute() {
  final RunResult<T> result = new RunResult<T>(this);

  try {
    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        performWriteCommandAction(result);
      }
    };
    Application application = ApplicationManager.getApplication();
    if (application.isWriteAccessAllowed() || application.isDispatchThread()) {
      runnable.run();
    }
    else {
      GuiUtils.invokeAndWait(runnable);
    }
  }
  catch (InvocationTargetException e) {
    throw new RuntimeException(e.getCause()); // save both stacktraces: current & EDT
  }
  catch (InterruptedException ignored) { }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:WriteCommandAction.java

示例10: tearDown

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@AfterMethod
protected void tearDown() throws Exception {
  GuiUtils.runOrInvokeAndWait(new Runnable() {
    @Override
    public void run() {
      try {
        tearDownProject();
        myProjectDirFixture.tearDown();
        myBrotherDirFixture.tearDown();
        myParentDirFixture.tearDown();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:GitTest.java

示例11: testDeleteDirRecursively

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Test
public void testDeleteDirRecursively() throws Exception {
  GuiUtils.runOrInvokeAndWait(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final VirtualFile dir = myRepo.getVFRootDir().findChild("dir");
          myDirtyScope.addDirtyDirRecursively(new FilePathImpl(dir));
          FileUtil.delete(VfsUtil.virtualToIoFile(dir));
        }
      });
    }
  });
  assertChanges(new VirtualFile[] { myFiles.get("dir/c.txt"), myFiles.get("dir/subdir/d.txt") }, new FileStatus[] { DELETED, DELETED });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GitChangeProviderVersionedTest.java

示例12: generateDoc

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
  if (element instanceof IProperty) {
    IProperty property = (IProperty)element;
    String text = property.getDocCommentText();

    @NonNls String info = "";
    if (text != null) {
      TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_COMMENT).clone();
      Color background = attributes.getBackgroundColor();
      if (background != null) {
        info +="<div bgcolor=#"+ GuiUtils.colorToHex(background)+">";
      }
      String doc = StringUtil.join(StringUtil.split(text, "\n"), "<br>");
      info += "<font color=#" + GuiUtils.colorToHex(attributes.getForegroundColor()) + ">" + doc + "</font>\n<br>";
      if (background != null) {
        info += "</div>";
      }
    }
    info += "\n<b>" + property.getName() + "</b>=\"" + renderPropertyValue(((IProperty)element)) + "\"";
    info += getLocationString(element);
    return info;
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PropertiesDocumentationProvider.java

示例13: generateDoc

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
  if (element instanceof DylanDefinition) {
    DylanDefinition definition = (DylanDefinition)element;
    String text = "Not supported yet";

    @NonNls String info = "";
    if (text != null) {
      TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DylanSyntaxHighlighterColors.COMMENT).clone();
      Color background = attributes.getBackgroundColor();
      if (background != null) {
        info +="<div bgcolor=#"+ GuiUtils.colorToHex(background)+">";
      }
      String doc = StringUtil.join(StringUtil.split(text, "\n"), "<br>");
      info += "<font color=#" + GuiUtils.colorToHex(attributes.getForegroundColor()) + ">" + doc + "</font>\n<br>";
      if (background != null) {
        info += "</div>";
      }
    }
    info += "\n<b>" + definition.getName() + "</b>";
    info += getLocationString(element);
    return info;
  }
  return null;
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:25,代码来源:DylanDefinitionDocumentationProvider.java

示例14: runOrInvokeAndWait

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
private static int runOrInvokeAndWait(@Nonnull final Computable<Integer> f) {
  final int[] answer = new int[1];
  try {
    GuiUtils.runOrInvokeAndWait(new Runnable() {
      @Override
      public void run() {
        answer[0] = f.compute();
      }
    });
  }
  catch (Exception e) {
    answer[0] = 0;
  }

  return answer[0];
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:UsageLimitUtil.java

示例15: scheduleInitialVfsRefresh

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public void scheduleInitialVfsRefresh() {
  GuiUtils.invokeLaterIfNeeded(() -> {
    if (myProject.isDisposed() || myInitialRefreshScheduled) return;

    myInitialRefreshScheduled = true;
    ((ProjectRootManagerImpl)ProjectRootManager.getInstance(myProject)).markRootsForRefresh();

    Application app = ApplicationManager.getApplication();
    if (!app.isCommandLine()) {
      final long sessionId = VirtualFileManager.getInstance().asyncRefresh(null);
      final MessageBusConnection connection = app.getMessageBus().connect();
      connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
        @Override
        public void afterProjectClosed(@Nonnull Project project) {
          if (project != myProject) return;

          RefreshQueue.getInstance().cancelSession(sessionId);
          connection.disconnect();
        }
      });
    }
    else {
      VirtualFileManager.getInstance().syncRefresh();
    }
  }, ModalityState.defaultModalityState());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:StartupManagerImpl.java


注:本文中的com.intellij.ui.GuiUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。