本文整理汇总了Java中javafx.scene.control.Tab.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.getProperties方法的具体用法?Java Tab.getProperties怎么用?Java Tab.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tab
的用法示例。
在下文中一共展示了Tab.getProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentEditor
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Get the current showed editor.
*
* @return the current editor.
*/
@FXThread
public @Nullable FileEditor getCurrentEditor() {
final Tab selectedTab = getSelectionModel().getSelectedItem();
if (selectedTab == null) return null;
final ObservableMap<Object, Object> properties = selectedTab.getProperties();
return (FileEditor) properties.get(KEY_EDITOR);
}
示例2: addEditor
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Add and open the new file editor.
*
* @param editor the editor
* @param needShow the need show
*/
@FXThread
private void addEditor(@NotNull final FileEditor editor, final boolean needShow) {
final Path editFile = editor.getEditFile();
final Tab tab = new Tab(editor.getFileName());
tab.setGraphic(new ImageView(ICON_MANAGER.getIcon(editFile, DEFAULT_FILE_ICON_SIZE)));
tab.setContent(editor.getPage());
tab.setOnCloseRequest(event -> handleRequestToCloseEditor(editor, tab, event));
final ObservableMap<Object, Object> properties = tab.getProperties();
properties.put(KEY_EDITOR, editor);
editor.dirtyProperty().addListener((observable, oldValue, newValue) -> {
tab.setText(newValue == Boolean.TRUE ? "*" + editor.getFileName() : editor.getFileName());
});
final ObservableList<Tab> tabs = getTabs();
tabs.add(tab);
if (needShow) {
final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
selectionModel.select(tab);
}
DictionaryUtils.runInWriteLock(getOpenedEditors(), editFile, tab, ObjectDictionary::put);
EditorUtil.decrementLoading();
if (isIgnoreOpenedFiles()) {
return;
}
final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();
if (workspace != null) {
workspace.addOpenedFile(editFile, editor);
}
}
示例3: handleMovedFiles
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Handle a moved/renamed file.
*
* @param prevFile the prev version of the file.
* @param newFile the new version of the file.
*/
@FXThread
private void handleMovedFiles(@NotNull final Path prevFile, @NotNull final Path newFile) {
final ConcurrentObjectDictionary<Path, Tab> openedEditors = getOpenedEditors();
final long stamp = openedEditors.writeLock();
try {
final Array<Path> files = openedEditors.keyArray(Path.class);
for (final Path file : files) {
if (!file.startsWith(prevFile)) {
continue;
}
final Tab tab = openedEditors.get(file);
final ObservableMap<Object, Object> properties = tab.getProperties();
final FileEditor fileEditor = (FileEditor) properties.get(KEY_EDITOR);
fileEditor.notifyRenamed(prevFile, newFile);
if (fileEditor.isDirty()) {
tab.setText("*" + fileEditor.getFileName());
} else {
tab.setText(fileEditor.getFileName());
}
final Path editFile = fileEditor.getEditFile();
openedEditors.remove(file);
openedEditors.put(editFile, tab);
final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();
if (workspace != null) {
workspace.removeOpenedFile(file);
workspace.addOpenedFile(editFile, fileEditor);
}
}
} finally {
openedEditors.writeUnlock(stamp);
}
}