public HotSwapProgressImpl(Project project) { super(project); myProgressWindow = new BackgroundableProcessIndicator(getProject(), myTitle, new PerformInBackgroundOption() { public boolean shouldStartInBackground() { return DebuggerSettings.getInstance().HOTSWAP_IN_BACKGROUND; } public void processSentToBackground() { } }, null, null, true); myProgressWindow.addStateDelegate(new AbstractProgressIndicatorExBase(){ @Override public void cancel() { super.cancel(); HotSwapProgressImpl.this.cancel(); } }); myUpdateQueue = new MergingUpdateQueue("HotSwapProgress update queue", 100, true, null, myProgressWindow); }
public AbstractTreeUpdater(@NotNull AbstractTreeBuilder treeBuilder) { myTreeBuilder = treeBuilder; final JTree tree = myTreeBuilder.getTree(); final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree; myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 300, component.isShowing(), component) { @Override protected Alarm createAlarm(@NotNull Alarm.ThreadToUse thread, Disposable parent) { return new Alarm(thread, parent) { @Override protected boolean isEdt() { return AbstractTreeUpdater.this.isEdt(); } }; } }; myUpdateQueue.setRestartTimerOnAdd(false); final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue); Disposer.register(this, myUpdateQueue); Disposer.register(this, uiNotifyConnector); }
protected void init() { LocalHistoryFacade facade = LocalHistoryImpl.getInstanceImpl().getFacade(); myModel = createModel(facade); setTitle(myModel.getTitle()); JComponent root = createComponent(); setComponent(root); setPreferredFocusedComponent(showRevisionsList() ? myRevisionsList.getComponent() : myDiffView); myUpdateQueue = new MergingUpdateQueue(getClass() + ".revisionsUpdate", 500, true, root, this, null, false); myUpdateQueue.setRestartTimerOnAdd(true); facade.addListener(new LocalHistoryFacade.Listener() { public void changeSetFinished() { scheduleRevisionsUpdate(null); } }, this); scheduleRevisionsUpdate(null); }
public EditorNotificationsImpl(Project project) { super(project); myUpdateMerger = new MergingUpdateQueue("EditorNotifications update merger", 100, true, null, project); MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() { @Override public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { updateNotifications(file); } }); connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { updateAllNotifications(); } @Override public void exitDumbMode() { updateAllNotifications(); } }); }
private DisposerTree(Disposable parent) { myModificationToFilter = -1; final DisposerStructure structure = new DisposerStructure(this); final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode()); final Tree tree = new Tree(model); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTreeBuilder = new FilteringTreeBuilder(tree, DisposerTree.this, structure, AlphaComparator.INSTANCE) { @Override public boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) { return structure.getRootElement() == getOriginalNode(nodeDescriptor); } }; myTreeBuilder.setFilteringMerge(200, MergingUpdateQueue.ANY_COMPONENT); Disposer.register(this, myTreeBuilder); myTree = tree; setLayout(new BorderLayout()); add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER); Disposer.getTree().addListener(this); Disposer.register(parent, this); }
public void doInitialize() { myDetectionQueue = new MergingUpdateQueue("FrameworkDetectionQueue", 500, true, null, myProject); if (ApplicationManager.getApplication().isUnitTestMode()) { myDetectionQueue.setPassThrough(false); myDetectionQueue.hideNotify(); } myDetectedFrameworksData = new DetectedFrameworksData(myProject); FrameworkDetectionIndex.getInstance().addListener(this, myProject); myProject.getMessageBus().connect().subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { myDetectionQueue.suspend(); } @Override public void exitDumbMode() { myDetectionQueue.resume(); } }); }
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public CommonAssetSetStep(TemplateWizardState state, @Nullable Project project, @Nullable Module module, @Nullable Icon sidePanelIcon, UpdateListener updateListener, @Nullable VirtualFile invocationTarget) { super(state, project, module, sidePanelIcon, updateListener); myAssetGenerator = new AssetStudioAssetGenerator(state); if (invocationTarget != null && module != null) { AndroidFacet facet = AndroidFacet.getInstance(myModule); if (facet != null) { mySourceProvider = Iterators.getNext(IdeaSourceProvider.getSourceProvidersForFile(facet, invocationTarget, null).iterator(), null); } } myUpdateQueue = new MergingUpdateQueue("asset.studio", 200, true, null, this, null, false); }
protected JComponent createComponent() { final JPanel panel = new MyPanel(); final JPanel toolbarPanel = new JPanel(new GridBagLayout()); final GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; toolbarPanel.add(myFileSystemToolBar.getComponent(), constraints); constraints.gridx = 1; constraints.weightx = 1.0; constraints.anchor = GridBagConstraints.EAST; toolbarPanel.add(myTextFieldAction, constraints); myNorthPanel.add(toolbarPanel, BorderLayout.NORTH); panel.add(myNorthPanel, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree()), BorderLayout.CENTER); panel.add(new JLabel(FileChooserDialogImpl.DRAG_N_DROP_HINT, SwingConstants.CENTER), BorderLayout.SOUTH); myUiUpdater = new MergingUpdateQueue("FileChooserUpdater", 200, false, panel); Disposer.register(myFileSystemTree, myUiUpdater); new UiNotifyConnector(panel, myUiUpdater); updateTextFieldShowing(); return panel; }
protected JComponent createComponent() { final JPanel panel = new MyPanel(); final JPanel toolbarPanel = new JPanel(new GridBagLayout()); final GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; toolbarPanel.add(myFileSystemToolBar.getComponent(), constraints); constraints.gridx = 1; constraints.weightx = 1.0; constraints.anchor = GridBagConstraints.EAST; toolbarPanel.add(myTextFieldAction, constraints); myNorthPanel.add(toolbarPanel, BorderLayout.NORTH); panel.add(myNorthPanel, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree()), BorderLayout.CENTER); panel.add(new JLabel( "<html><center><small><font color=gray>Drag and drop a file into the space above to quickly locate it in the tree.</font></small></center></html>", SwingConstants.CENTER), BorderLayout.SOUTH); myUiUpdater = new MergingUpdateQueue("FileChooserUpdater", 200, false, panel); Disposer.register(myFileSystemTree, myUiUpdater); new UiNotifyConnector(panel, myUiUpdater); updateTextFieldShowing(); return panel; }
public AbstractTreeUpdater(@Nonnull AbstractTreeBuilder treeBuilder) { myTreeBuilder = treeBuilder; final JTree tree = myTreeBuilder.getTree(); final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree; myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 100, component.isShowing(), component) { @Override protected Alarm createAlarm(@Nonnull Alarm.ThreadToUse thread, Disposable parent) { return new Alarm(thread, parent) { @Override protected boolean isEdt() { return AbstractTreeUpdater.this.isEdt(); } }; } }; myUpdateQueue.setRestartTimerOnAdd(false); final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue); Disposer.register(this, myUpdateQueue); Disposer.register(this, uiNotifyConnector); }
public PresentationModeProgressPanel(InlineProgressIndicator progress) { myProgress = progress; Font font = JBUI.Fonts.label(11); myText.setFont(font); myText2.setFont(font); myText.setIcon(JBUI.scale(EmptyIcon.create(1, 16))); myText2.setIcon(JBUI.scale(EmptyIcon.create(1, 16))); myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null); myUpdate = new Update("Update UI") { @Override public void run() { updateImpl(); } }; myEastButtons = myProgress.createEastButtons(); myButtonPanel.add(InlineProgressIndicator.createButtonPanel(myEastButtons.map(b -> b.button))); }
protected Updater(@Nonnull Painter painter, JScrollBar bar) { myPainter = painter; myScrollBar = bar; myScrollBar.addMouseListener(myMouseAdapter); myScrollBar.addMouseMotionListener(myMouseAdapter); myQueue = new MergingUpdateQueue("ErrorStripeUpdater", 100, true, myScrollBar, this); UIUtil.putClientProperty(myScrollBar, ScrollBarUIConstants.TRACK, (g, x, y, width, height, object) -> { DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance(); myPainter.setMinimalThickness(settings == null ? 2 : Math.min(settings.ERROR_STRIPE_MARK_MIN_HEIGHT, JBUI.scale(4))); myPainter.setErrorStripeGap(1); if (myPainter instanceof ExtraErrorStripePainter) { ExtraErrorStripePainter extra = (ExtraErrorStripePainter)myPainter; extra.setGroupSwap(!myScrollBar.getComponentOrientation().isLeftToRight()); } myPainter.paint(g, x, y, width, height, object); }); }
public EditorNotificationsImpl(Project project) { myProject = project; myUpdateMerger = new MergingUpdateQueue("EditorNotifications update merger", 100, true, null, project); MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() { @Override public void fileOpened(@Nonnull FileEditorManager source, @Nonnull VirtualFile file) { updateNotifications(file); } }); connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { updateAllNotifications(); } @Override public void exitDumbMode() { updateAllNotifications(); } }); }
public ProjectStructureDaemonAnalyzer(StructureConfigurableContext context) { Disposer.register(context, this); myProjectConfigurationProblems = new ProjectConfigurationProblems(this, context); myAnalyzerQueue = new MergingUpdateQueue("Project Structure Daemon Analyzer", 300, false, null, this, null, Alarm.ThreadToUse.POOLED_THREAD); myResultsUpdateQueue = new MergingUpdateQueue("Project Structure Analysis Results Updater", 300, false, MergingUpdateQueue.ANY_COMPONENT, this, null, Alarm.ThreadToUse.SWING_THREAD); }
@Nullable protected AbstractTreeUpdater createUpdater() { if (isDisposed()) return null; AbstractTreeUpdater updater = new AbstractTreeUpdater(this); updater.setModalityStateComponent(MergingUpdateQueue.ANY_COMPONENT); return updater; }
public PresentationModeProgressPanel(InlineProgressIndicator progress) { myProgress = progress; Font font = JBUI.Fonts.label(11); myText.setFont(font); myText2.setFont(font); myText.setIcon(EmptyIcon.create(1, 16)); myText2.setIcon(EmptyIcon.create(1, 16)); myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null); myUpdate = new Update("Update UI") { @Override public void run() { updateImpl(); } }; }
static AbstractTreeUpdater _createUpdater(AbstractTreeBuilder builder) { final AbstractTreeUpdater updater = new AbstractTreeUpdater(builder) { @Override protected boolean isEdt() { return SwingUtilities.isEventDispatchThread(); } }; updater.setModalityStateComponent(MergingUpdateQueue.ANY_COMPONENT); return updater; }
public ExternalToolPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) { super(project); // start after PostHighlightingPass completion since it could report errors that can prevent us to run highlightingPassRegistrar.registerTextEditorHighlightingPass(this, new int[]{Pass.UPDATE_ALL}, null, true, Pass.EXTERNAL_TOOLS); myExternalActivitiesQueue = new MergingUpdateQueue("ExternalActivitiesQueue", 300, true, MergingUpdateQueue.ANY_COMPONENT, project, null, false); myExternalActivitiesQueue.setPassThrough(ApplicationManager.getApplication().isUnitTestMode()); }
public NavBarUpdateQueue(NavBarPanel panel) { super("NavBar", Registry.intValue("navBar.updateMergeTime"), true, MergingUpdateQueue.ANY_COMPONENT, panel); myPanel = panel; setTrackUiActivity(true); IdeEventQueue.getInstance().addActivityListener(new Runnable() { @Override public void run() { restartRebuild(); } }, panel); }
public AndroidLayoutPreviewToolWindowManager(final Project project, final FileEditorManager fileEditorManager) { myProject = project; myFileEditorManager = fileEditorManager; myToolWindowUpdateQueue = new MergingUpdateQueue("android.layout.preview", 100, true, null, project); final MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener()); connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyAndroidPlatformListener(project)); initListeners(project); }
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public IconStep(Key<TemplateEntry> templateKey, Key<SourceProvider> sourceProviderKey, @Nullable SourceProvider[] sourceProviders, Disposable disposable) { super(disposable); myTemplateKey = templateKey; mySourceProviderKey = sourceProviderKey; mySourceProviders = sourceProviders; myScalingButtons = new JComponent[]{myCropRadioButton, myCenterRadioButton}; myShapeButtons = new JComponent[]{myNoneRadioButton, mySquareRadioButton, myCircleRadioButton}; myUpdateQueue = new MergingUpdateQueue("asset.studio", 200, true, null, this, null, false); myImageFile.addBrowseFolderListener(null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); setBodyComponent(myPanel); }
public MavenImportNotifier(Project p, MavenProjectsManager mavenProjectsManager) { super(p); if (!isNormalProject()) return; NotificationsConfiguration.getNotificationsConfiguration().register(MAVEN_IMPORT_NOTIFICATION_GROUP, NotificationDisplayType.STICKY_BALLOON, true); myMavenProjectsManager = mavenProjectsManager; myUpdatesQueue = new MergingUpdateQueue(getComponentName(), 500, false, MergingUpdateQueue.ANY_COMPONENT, myProject); myMavenProjectsManager.addManagerListener(new MavenProjectsManager.Listener() { public void activated() { init(); } public void projectsScheduled() { scheduleUpdate(false); } @Override public void importAndResolveScheduled() { scheduleUpdate(true); } }); }
static AbstractTreeUpdater _createUpdater(AbstractTreeBuilder builder) { final AbstractTreeUpdater updater = new AbstractTreeUpdater(builder) { @Override protected void invokeLater(Runnable runnable) { runnable.run(); } @Override protected boolean isEdt() { return SwingUtilities.isEventDispatchThread(); } }; updater.setModalityStateComponent(MergingUpdateQueue.ANY_COMPONENT); return updater; }
public CompletionProgressIndicator(final Editor editor, CompletionParameters parameters, CodeCompletionHandlerBase handler, Semaphore freezeSemaphore, final OffsetMap offsetMap, boolean hasModifiers) { myEditor = editor; myParameters = parameters; myHandler = handler; myFreezeSemaphore = freezeSemaphore; myOffsetMap = offsetMap; myLookup = (LookupImpl)parameters.getLookup(); myStartCaret = myEditor.getCaretModel().getOffset(); myLookup.setArranger(new CompletionLookupArranger(parameters, this)); myLookup.addLookupListener(myLookupListener); myLookup.setCalculating(true); myLookupManagerListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() != null) { LOG.error("An attempt to change the lookup during completion, phase = " + CompletionServiceImpl.getCompletionPhase()); } } }; LookupManager.getInstance(getProject()).addPropertyChangeListener(myLookupManagerListener); myQueue = new MergingUpdateQueue("completion lookup progress", 300, true, myEditor.getContentComponent()); myQueue.setPassThrough(false); ApplicationManager.getApplication().assertIsDispatchThread(); Disposer.register(this, offsetMap); if (hasModifiers && !ApplicationManager.getApplication().isUnitTestMode()) { trackModifiers(); } }
public ExternalToolPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) { super(project); // start after PostHighlightingPass completion since it could report errors that can prevent us to run highlightingPassRegistrar.registerTextEditorHighlightingPass(this, new int[]{Pass.POST_UPDATE_ALL}, null, true, Pass.EXTERNAL_TOOLS); myExternalActivitiesQueue = new MergingUpdateQueue("ExternalActivitiesQueue", 300, true, MergingUpdateQueue.ANY_COMPONENT, project, null, false); }
public AnnotationsPreloader(final Project project) { myProject = project; myUpdateQueue = new MergingUpdateQueue("Annotations preloader queue", 1000, true, null, project, null, false); project.getMessageBus().connect(project).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { @Override public void selectionChanged(@Nonnull FileEditorManagerEvent event) { if (!isEnabled()) return; VirtualFile file = event.getNewFile(); if (file != null) { schedulePreloading(file); } } }); }
public ServerConnectionEventDispatcher() { myMessageBus = ApplicationManager.getApplication().getMessageBus(); myEventsQueue = new MergingUpdateQueue("remote server connection events", 500, false, null); }
SpotlightPainter(JComponent target, Disposable parent) { myQueue = new MergingUpdateQueue("SettingsSpotlight", 200, false, target, parent, target); myGlassPanel = new GlassPanel(target); myTarget = target; IdeGlassPaneUtil.installPainter(target, this, parent); }