• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GuiUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: runWhenProjectIsInitialized

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@Override
public void runWhenProjectIsInitialized(@Nonnull final Runnable action) {
  final Application application = ApplicationManager.getApplication();
  if (application == null) return;

  Runnable runnable = () -> {
    if (myProject.isDisposed()) return;

    //noinspection SynchronizeOnThis
    synchronized (this) {
      // in tests which simulate project opening, post-startup activities could have been run already.
      // Then we should act as if the project was initialized
      boolean initialized = myProject.isInitialized() || myProject.isDefault() || application.isUnitTestMode() && myPostStartupActivitiesPassed;
      if (!initialized) {
        registerPostStartupActivity(action);
        return;
      }
    }

    action.run();
  };
  GuiUtils.invokeLaterIfNeeded(runnable, ModalityState.NON_MODAL);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:StartupManagerImpl.java


示例17: UnscrambleDialog

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public UnscrambleDialog(Project project)
{
	super(false);
	myProject = project;

	populateRegisteredUnscramblerList();
	myUnscrambleChooser.addActionListener(e ->
	{
		UnscrambleSupport unscrambleSupport = getSelectedUnscrambler();
		GuiUtils.enableChildren(myLogFileChooserPanel, unscrambleSupport != null);
	});
	myUseUnscrambler.addActionListener(e -> useUnscramblerChanged());
	myOnTheFly.setSelected(UnscrambleManager.getInstance().isEnabled());
	myOnTheFly.addActionListener(e -> UnscrambleManager.getInstance().setEnabled(myOnTheFly.isSelected()));
	createLogFileChooser();
	createEditor();
	reset();

	setTitle(IdeBundle.message("unscramble.dialog.title"));
	init();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:UnscrambleDialog.java


示例18: setTextFieldPreferredWidth

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public void setTextFieldPreferredWidth(final int charCount) {
  final Comp comp = getChildComponent();
  Dimension size = GuiUtils.getSizeByChars(charCount, comp);
  comp.setPreferredSize(size);
  final Dimension preferredSize = myBrowseButton.getPreferredSize();
  setPreferredSize(new Dimension(size.width + preferredSize.width + 2, UIUtil.isUnderAquaLookAndFeel() ? preferredSize.height : preferredSize.height + 2));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ComponentWithBrowseButton.java


示例19: createComponent

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
@NotNull
@Override
public JComponent createComponent() {
  GuiUtils.replaceJSplitPaneWithIDEASplitter(myPanel);
  if (null == myInnerPostfixDescriptionPanel) {
    myInnerPostfixDescriptionPanel = new PostfixDescriptionPanel();
    myDescriptionPanel.add(myInnerPostfixDescriptionPanel.getComponent());
  }
  if (null == myCheckboxTree) {
    createTree();
    myCheckboxTree.initTree(templateMultiMap);
  }

  return myPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PostfixTemplatesConfigurable.java


示例20: setupImpl

import com.intellij.ui.GuiUtils; //导入依赖的package包/类
public synchronized void setupImpl(@NotNull ToolWindow toolWindow, final boolean loadPaneExtensions) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  myActionGroup = new DefaultActionGroup();

  myAutoScrollFromSourceHandler.install();

  myContentManager = toolWindow.getContentManager();
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    toolWindow.setDefaultContentUiType(ToolWindowContentUiType.COMBO);
    ((ToolWindowEx)toolWindow).setAdditionalGearActions(myActionGroup);
    toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
  }

  GuiUtils.replaceJSplitPaneWithIDEASplitter(myPanel);
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      splitterProportions.restoreSplitterProportions(myPanel);
    }
  });

  if (loadPaneExtensions) {
    ensurePanesLoaded();
  }
  isInitialized = true;
  doAddUninitializedPanes();

  myContentManager.addContentManagerListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
        viewSelectionChanged();
      }
    }
  });
  viewSelectionChanged();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ProjectViewImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SocketConnector类代码示例发布时间:2022-05-21
下一篇:
Java ReceiverAdapter类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap