⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtextoptionsdialog.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			}

			else if (currentPanel instanceof ShortcutOptionPanel) {
				ShortcutOptionPanel sop = (ShortcutOptionPanel)currentPanel;
				Action[] actions = sop.getActions();
				int actionsLength = actions.length;
				Action[] realActions = rtext.getActions();
				int j;
				for (int k=0; k<realActions.length; k++) {
					String name = (String)realActions[k].getValue(Action.NAME);
					for (j=0; j<actionsLength; j++) {
						String name2 = (String)actions[j].getValue(Action.NAME);
						if (name.equals(name2)) {
							realActions[k].putValue(Action.ACCELERATOR_KEY, actions[j].getValue(Action.ACCELERATOR_KEY));
							break;
						}
					}
					if (j==actionsLength)
						System.err.println("err0r!!!!");
				}
				realActions = rtext.getMainView().getActions();
				for (int k=0; k<realActions.length; k++) {
					String name = (String)realActions[k].getValue(Action.NAME);
					for (j=0; j<actionsLength; j++) {
						String name2 = (String)actions[j].getValue(Action.NAME);
						if (name.equals(name2)) {
							realActions[k].putValue(Action.ACCELERATOR_KEY, actions[j].getValue(Action.ACCELERATOR_KEY));
							break;
						}
					}
					if (j==actionsLength)
						System.err.println("err0r!!!!");
				}
				// HORRIBLE workaround for Java Bug ID 5026829 (JMenuItems,
				// among other Swing components, don't update themselves
				// when the Actions on which they were created have their
				// properties changed).
				rtext.menuItemAcceleratorWorkaround();
			}

			else if (currentPanel instanceof RTextFileChooserOptionPanel) {
				RTextFileChooserOptionPanel rop = (RTextFileChooserOptionPanel)currentPanel;
				rop.configureFileChooser(rtext.getFileChooser());
			}

			else {
				ResourceBundle msg = rtext.getResourceBundle();
				JOptionPane.showMessageDialog(this, msg.getString("UnknownPanelType") + currentPanel,
										msg.getString("ErrorDialogTitle"),
										JOptionPane.ERROR_MESSAGE);
			}

		} // End of for (int i=0; i<numPanels; i++).

		owner.repaint();

	}


/*****************************************************************************/


	/**
	 * Initializes all fields/radio buttons/etc. in this options dialog
	 * with their proper states as obtained from the owner of this options
	 * dialog (as passed into the constructor).
 	 *
	 * @see org.fife.ui.OptionsDialog#initialize
	 */
	public void initialize() {

		RText owner = (RText)getParent();
		AbstractMainView mainView = owner.getMainView();

		OptionsDialogPanel[] panels = getOptionsDialogPanels();
		int numPanels = panels.length;

		for (int i=0; i<numPanels; i++) {

			OptionsDialogPanel currentPanel = panels[i];

			if (currentPanel instanceof GeneralOptionPanel) {
				GeneralOptionPanel gop = (GeneralOptionPanel)currentPanel;
				gop.setWorkingDirectory(owner.getWorkingDirectory());
			}

			else if (currentPanel instanceof UIOptionPanel) {
				UIOptionPanel uiop = (UIOptionPanel)currentPanel;
				uiop.setDocumentSelectionPlacement(mainView.getDocumentSelectionPlacement());
				uiop.setLookAndFeelByClassName(UIManager.getLookAndFeel().getClass().getName());
				uiop.setIconGroupByName(owner.getIconGroup().getName());
				uiop.setMainViewStyle(owner.getMainViewStyle());
				uiop.setHighlightModifiedDocumentDisplayNames(mainView.highlightModifiedDocumentDisplayNames());
				uiop.setStatusBarStyle(owner.getStatusBar().getStyle());
				uiop.setModifiedDocumentDisplayNamesColor(mainView.getModifiedDocumentDisplayNamesColor());
			}

			else if (currentPanel instanceof PrintingOptionPanel) {
				PrintingOptionPanel pop = (PrintingOptionPanel)currentPanel;
				pop.setPrintFont(mainView.getPrintFont());
				//pop.setPrintHeader(mainView.printHeader());
				//pop.setPrintFooter(mainView.printFooter());
			}

			else if (currentPanel instanceof RTextAreaOptionPanel) {

				RTextAreaOptionPanel taop = (RTextAreaOptionPanel)currentPanel;
				taop.setCaretColor(mainView.getCaretColor());
				taop.setSelectionColor(mainView.getSelectionColor());
				taop.setMarkAllHighlightColor(mainView.getMarkAllHighlightColor());
				taop.setBackgroundObject(mainView.getBackgroundObject());
				taop.setBackgroundImageFileName(mainView.getBackgroundImageFileName());
				taop.setWordWrap(mainView.getLineWrap());
				taop.setCurrentLineHighlightCheckboxSelected(mainView.isCurrentLineHighlightEnabled());
				taop.setCurrentLineHighlightColor(mainView.getCurrentLineHighlightColor());
				taop.setTabSize(mainView.getTabSize());
				taop.setEmulateTabs(mainView.areTabsEmulated());
				taop.setMarginLineEnabled(mainView.isMarginLineEnabled());
				taop.setMarginLinePosition(mainView.getMarginLinePosition());
				taop.setMarginLineColor(mainView.getMarginLineColor());
				taop.setRoundedSelection(mainView.getRoundedSelectionEdges());
				taop.setCaretStyle(RTextArea.INSERT_MODE, mainView.getCaretStyle(RTextArea.INSERT_MODE));
				taop.setCaretStyle(RTextArea.OVERWRITE_MODE, mainView.getCaretStyle(RTextArea.OVERWRITE_MODE));
				taop.setBlinkRate(mainView.getCaretBlinkRate());

				// Syntax highlighting panel is the first child.
				RSyntaxTextAreaOptionPanel rstaop = (RSyntaxTextAreaOptionPanel)currentPanel.getChildPanel(0);
				rstaop.setSyntaxHighlightingColorScheme(owner.getSyntaxHighlightingColorScheme());
				boolean bmEnabled = mainView.isBracketMatchingEnabled();
				rstaop.setBracketMatchCheckboxSelected(bmEnabled);
				rstaop.setBracketMatchBGColor(mainView.getMatchedBracketBGColor());
				rstaop.setBracketMatchBorderColor(mainView.getMatchedBracketBorderColor());
				rstaop.setWhitespaceVisible(mainView.isWhitespaceVisible());
				rstaop.setSmoothTextEnabled(mainView.isSmoothTextEnabled());
				rstaop.setFractionalFontMetricsEnabled(mainView.isFractionalFontMetricsEnabled());

				// Template panel is the second child.
				TemplateOptionPanel top = (TemplateOptionPanel)currentPanel.getChildPanel(1);
				top.initialize();

				// Macro panel is the third child.
				MacroOptionPanel mop = (MacroOptionPanel)currentPanel.getChildPanel(2);
				mop.initialize();

			}

			else if (currentPanel instanceof LanguageOptionPanel) {
				LanguageOptionPanel lop = (LanguageOptionPanel)currentPanel;
				lop.setSelectedLanguage(owner.getLanguage());
			}

			else if (currentPanel instanceof FileFilterOptionPanel) {
				FileFilterOptionPanel ffop = (FileFilterOptionPanel)currentPanel;
				ffop.setSyntaxFilters(mainView.getSyntaxFilters());
			}

			else if (currentPanel instanceof ShortcutOptionPanel) {
				ShortcutOptionPanel sop = (ShortcutOptionPanel)currentPanel;
				sop.setActions(owner.getActions(), mainView.getActions());
			}

			else if (currentPanel instanceof RTextFileChooserOptionPanel) {
				RTextFileChooserOptionPanel rop = (RTextFileChooserOptionPanel)currentPanel;
				rop.initialize(owner.getFileChooser());
			}

			else {
				ResourceBundle msg = owner.getResourceBundle();
				JOptionPane.showMessageDialog(this, msg.getString("UnknownPanelType") + currentPanel,
										msg.getString("ErrorDialogTitle"),
										JOptionPane.ERROR_MESSAGE);
			}

			// Clear the "unsaved changes" flag for the panel.
			currentPanel.setUnsavedChanges(false);

		} // End of for (int i=0; i<numPanels; i++).

		setApplyButtonEnabled(false);

	}


/*****************************************************************************/

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -