public void stopProcess() { if (myParsingThread != null) { myParsingThread.stopProcess(); } myIsAborted = true; myLeftToolbar.updateActionsImmediately(); myRightToolbar.updateActionsImmediately(); }
@Nullable @Override protected JComponent createCenterPanel() { myPanel.setSplitterProportionKey(getClass().getName() + "ModelTreeSplitter"); myTree = new ModelDifferenceDialog.ModelDifferenceTree(); myPanel.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree)); myPanel.setSecondComponent(myNoRootPanel); myGoToNeighbourRootActions = new ModelDifferenceDialog.MyGoToNeighbourRootActions(); myGoToNeighbourRootActions .previous() .registerCustomShortcutSet(GoToNeighbourRootActions.PREV_ROOT_SHORTCUT, myComponent); myGoToNeighbourRootActions .next() .registerCustomShortcutSet(GoToNeighbourRootActions.NEXT_ROOT_SHORTCUT, myComponent); myToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myActionGroup, true); myToolbar.updateActionsImmediately(); myComponent.add(myToolbar.getComponent(), BorderLayout.NORTH); myComponent.add(myPanel, BorderLayout.CENTER); myComponent.add(myStatusBar, BorderLayout.SOUTH); Dimension size = DimensionService.getInstance().getSize(getDimensionServiceKey()); if (size == null) { myComponent.setPreferredSize(new Dimension(500, 700)); } return myComponent; }
private void updateControlState() { ElementLocationUtil.customizeElementLabel( myElement != null ? myElement.getElement() : null, myElementLabel); myToolBar.updateActionsImmediately(); // update faster setControlPanelVisible(true); // (!myBackStack.isEmpty() || !myForwardStack.isEmpty()); }
private void updateControls() { updateLabels(); updateCombo(); updateEditorText(); myToolbar.updateActionsImmediately(); }
private void updateActions() { if (myToolbar == null) return; myToolbar.updateActionsImmediately(); }
ImageEditorUI(@Nullable ImageEditor editor) { this.editor = editor; Options options = OptionsManager.getInstance().getOptions(); EditorOptions editorOptions = options.getEditorOptions(); options.addPropertyChangeListener(optionsChangeListener); final PsiActionSupportFactory factory = PsiActionSupportFactory.getInstance(); if (factory != null && editor != null) { copyPasteSupport = factory.createPsiBasedCopyPasteSupport( editor.getProject(), this, new PsiActionSupportFactory.PsiElementSelector() { public PsiElement[] getSelectedElements() { PsiElement[] data = LangDataKeys.PSI_ELEMENT_ARRAY.getData(ImageEditorUI.this); return data == null ? PsiElement.EMPTY_ARRAY : data; } }); } else { copyPasteSupport = null; } deleteProvider = factory == null ? null : factory.createPsiBasedDeleteProvider(); ImageDocument document = imageComponent.getDocument(); document.addChangeListener(changeListener); // Set options TransparencyChessboardOptions chessboardOptions = editorOptions.getTransparencyChessboardOptions(); GridOptions gridOptions = editorOptions.getGridOptions(); imageComponent.setTransparencyChessboardCellSize(chessboardOptions.getCellSize()); imageComponent.setTransparencyChessboardWhiteColor(chessboardOptions.getWhiteColor()); imageComponent.setTransparencyChessboardBlankColor(chessboardOptions.getBlackColor()); imageComponent.setGridLineZoomFactor(gridOptions.getLineZoomFactor()); imageComponent.setGridLineSpan(gridOptions.getLineSpan()); imageComponent.setGridLineColor(gridOptions.getLineColor()); // Create layout ImageContainerPane view = new ImageContainerPane(imageComponent); view.addMouseListener(new EditorMouseAdapter()); view.addMouseListener(new FocusRequester()); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(view); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Zoom by wheel listener scrollPane.addMouseWheelListener(wheelAdapter); // Construct UI setLayout(new BorderLayout()); ActionManager actionManager = ActionManager.getInstance(); ActionGroup actionGroup = (ActionGroup) actionManager.getAction(ImageEditorActions.GROUP_TOOLBAR); ActionToolbar actionToolbar = actionManager.createActionToolbar(ImageEditorActions.ACTION_PLACE, actionGroup, true); // Make sure toolbar is 'ready' before it's added to component hierarchy // to prevent ActionToolbarImpl.updateActionsImpl(boolean, boolean) from increasing popup size // unnecessarily actionToolbar.updateActionsImmediately(); actionToolbar.setTargetComponent(this); JComponent toolbarPanel = actionToolbar.getComponent(); toolbarPanel.addMouseListener(new FocusRequester()); JLabel errorLabel = new JLabel( ImagesBundle.message("error.broken.image.file.format"), Messages.getErrorIcon(), SwingConstants.CENTER); JPanel errorPanel = new JPanel(new BorderLayout()); errorPanel.add(errorLabel, BorderLayout.CENTER); contentPanel = new JPanel(new CardLayout()); contentPanel.add(scrollPane, IMAGE_PANEL); contentPanel.add(errorPanel, ERROR_PANEL); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(toolbarPanel, BorderLayout.WEST); infoLabel = new JLabel((String) null, SwingConstants.RIGHT); infoLabel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2)); topPanel.add(infoLabel, BorderLayout.EAST); add(topPanel, BorderLayout.NORTH); add(contentPanel, BorderLayout.CENTER); updateInfo(); }