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


Java FileLocation类代码示例

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


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

示例1: EditorPanel

import org.fife.ui.rsyntaxtextarea.FileLocation; //导入依赖的package包/类
public EditorPanel(Script script) {
	try {
		filename = script.getName();
		editor = new TextEditorPane(RTextArea.INSERT_MODE, false, FileLocation.create(new File(filename)));
		editor.setText(script.getCode());
		editor.setCaretPosition(0);
		
		// editor tweaks
		editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
		editor.setCodeFoldingEnabled(true);
		editor.setAntiAliasingEnabled(true);

		// auto-completion
		/*
		if (ac != null) {
			ac.install(editor);
			ac.setShowDescWindow(true);
		}
		*/
		
		panel = new RTextScrollPane(editor);
		
	} catch (Exception e) {
		Logging.logError(e);
	}
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:27,代码来源:EditorPanel.java

示例2: openFile

import org.fife.ui.rsyntaxtextarea.FileLocation; //导入依赖的package包/类
/**
 * Opens a file.  Prompts the user to save if the existing file is dirty.
 *
 * @param file The file to open.
 */
private void openFile(File file) {

	if (webDemoCheck()) {
		return;
	}

	if (!saveIfDirty()) {
		return;
	}

	FileLocation loc = FileLocation.create(file);
	try {
		((TextEditorPane)textArea).load(loc, null);
		refreshTitle();
	} catch (IOException ioe) {
		String message = "Error load file " + loc.getFileName() + ":\n" +
				ioe.getMessage();
		String title = "Could not load file";
		JOptionPane.showMessageDialog(this, message, title,
				JOptionPane.ERROR_MESSAGE);
		ioe.printStackTrace();
	}

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:30,代码来源:DemoRootPane.java

示例3: EditorPanel

import org.fife.ui.rsyntaxtextarea.FileLocation; //导入依赖的package包/类
public EditorPanel(Script script) {
	try {
		filename = script.getName();
		editor = new TextEditorPane(RTextArea.INSERT_MODE, false, FileLocation.create(new File(filename)));
		editor.setText(script.getCode());
		editor.setCaretPosition(0);

		panel = createEditorPane();
	} catch (Exception e) {
		Logging.logError(e);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:13,代码来源:PythonGUI.java

示例4: saveImpl

import org.fife.ui.rsyntaxtextarea.FileLocation; //导入依赖的package包/类
private boolean saveImpl(FileLocation newLoc) {

		boolean success = true;

		if (!webDemo) {
			TextEditorPane textArea = (TextEditorPane)this.textArea;
			try {
				if (newLoc!=null) {
					textArea.saveAs(newLoc);
					refreshTitle();
				}
				else {
					textArea.save();
				}
			} catch (IOException ioe) {
				String message = "Error saving file:\n" + ioe.getMessage();
				String title = "Could not save file";
				JOptionPane.showMessageDialog(this, message, title,
						JOptionPane.ERROR_MESSAGE);
				ioe.printStackTrace();
				success = false;
			}
		}

		return success;

	}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:28,代码来源:DemoRootPane.java

示例5: actionPerformed

import org.fife.ui.rsyntaxtextarea.FileLocation; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {

	if (webDemoCheck()) {
		return;
	}

	if (chooser==null) {
		createFileChooser();
	}

	int rc = chooser.showSaveDialog(DemoRootPane.this);
	if (rc!=JFileChooser.APPROVE_OPTION) {
		return;
	}

	File file = chooser.getSelectedFile();
	if (file.exists()) {
		String msg = "File already exists:\n" +
				file.getAbsolutePath() + "\n" +
				"Do you wish to overwrite it?";
		rc = JOptionPane.showConfirmDialog(DemoRootPane.this, msg);
		if (rc!=JOptionPane.YES_OPTION) {
			return;
		}
	}

	FileLocation loc = FileLocation.create(file);
	saveImpl(loc);

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:32,代码来源:DemoRootPane.java


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