use of main.utilities.workspace.Workspace in project Eidolons by IDemiurge.
the class TabBuilder method initSelectedWorkspace.
private void initSelectedWorkspace(G_TabbedPanel tab) {
G_Panel tabComp = (G_Panel) tab.getTabs().getSelectedComponent();
Workspace workspace = ArcaneVault.getWorkspaceManager().getWorkspaceByTab(tabComp);
if (workspace != null) {
tabComp.removeAll();
Component generateWorkspaceTree = generateWorkspaceTree(workspace);
tabComp.add(generateWorkspaceTree, "pos 0 0 " + ArcaneVault.TREE_WIDTH + " " + ArcaneVault.TABLE_HEIGHT + "-" + ArcaneVault.TREE_HEIGHT + "/20");
tabComp.revalidate();
workspace.setDirty(false);
}
}
use of main.utilities.workspace.Workspace in project Eidolons by IDemiurge.
the class SearchMaster method newSearch.
public static void newSearch() {
// getOrCreate TYPES
// getOrCreate search text, perhaps with some basic regex syntax like "not",
// "or"...
// List<OBJ_TYPE> types = new ArrayList<>();
// int i = DialogMaster.optionChoice(OBJ_TYPES.values(),
// "include object type... (at least one)");
// // C_TYPES?
// if (i == -1)
// return;
// types.add(OBJ_TYPES.values()[i]);
// while (true) {
// i = DialogMaster.optionChoice(OBJ_TYPES.values(),
// "include another object type...");
// if (i == -1)
// break;
// if (!types.contains(OBJ_TYPES.values()[i]))
// types.add(OBJ_TYPES.values()[i]);
// }
// OBJ_TYPE[] TYPES = new OBJ_TYPE[types.size()];
List<ObjType> list;
String typeName = DialogMaster.inputText("Enter type search...", TypeFinder.getLastSearch());
// TODO update search?
if (ArcaneVault.getWorkspaceManager().getWorkspaceByName(typeName) != null) {
deleteSearch(typeName);
}
if (!StringMaster.isEmpty(typeName)) {
list = TypeFinder.findTypes(typeName, // types.toArray(TYPES)
DC_TYPE.values());
} else {
// guess
return;
}
// grouping - always by TYPE?
Workspace ws = new Workspace(typeName, list, true);
ArcaneVault.getWorkspaceManager().addWorkspace(ws);
ArcaneVault.getMainBuilder().getTabBuilder().addWorkspaceTab(ws);
}
use of main.utilities.workspace.Workspace in project Eidolons by IDemiurge.
the class LE_Palette method loadWorkspaces.
public void loadWorkspaces() {
workspaces = new ArrayList<>();
List<File> files = FileManager.findFiles(FileManager.getFile(getWorkspaceFolder()), ".xml", false, false);
for (File file : files) {
// String data = FileManager.readFile(file);
// new PaletteWorkspace(name, typeList, data);
// )
Workspace ws = LE_DataMaster.getWorkspaceManager().loadWorkspace(file.getPath());
workspaces.add(new PaletteWorkspace(ws.getName(), ws.getTypeList(), ws.getMetaData()));
}
}
use of main.utilities.workspace.Workspace in project Eidolons by IDemiurge.
the class AV_TreeSelectionListener method valueChanged.
@Override
public void valueChanged(TreeSelectionEvent e1) {
if (e1 == null) {
return;
}
tree.requestFocusInWindow();
boolean dtFlag = ArcaneVault.isDirty();
if (((JTree) e1.getSource()).getSelectionPath() == null) {
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) (((JTree) e1.getSource()).getSelectionPath().getLastPathComponent());
if (node == null) {
return;
}
String name = (String) node.getUserObject();
String tab;
if (panel.isLevelEditor()) {
tab = LevelEditor.getSimulation().getSelectedEntity().getOBJ_TYPE();
} else {
tab = ArcaneVault.getMainBuilder().getSelectedTabName();
}
if (tab == null) {
Workspace workspace = ArcaneVault.getWorkspaceManager().getWorkspaceByTab((G_Panel) SwingMaster.getParentOfClass(tree, G_Panel.class));
if (workspace != null) {
try {
tab = workspace.getOBJ_TYPE(name, tab).getName();
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
}
if (SimulationManager.isUnitType(tab) && ArcaneVault.isSimulationOn()) {
try {
SimulationManager.initUnitObj(name);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
}
ObjType type = DataManager.getType(name, tab);
if (type == null) {
for (TabBuilder t : ArcaneVault.getAdditionalTrees()) {
type = DataManager.getType(name, t.getSelectedTabName());
if (type != null) {
break;
}
}
}
if (type == null) {
type = DataManager.getType(name);
}
if (type == null) {
return;
}
selectType(type, tab);
List<ObjType> types = new ArrayList<>();
int length = 1;
try {
length = e1.getPaths().length;
} catch (Exception e) {
}
if (length > 2) {
// TODO
try {
for (TreePath p : e1.getPaths()) {
node = (DefaultMutableTreeNode) p.getLastPathComponent();
if (node == null) {
continue;
}
name = (String) node.getUserObject();
type = DataManager.getType(name, tab);
if (type != null) {
types.add(type);
}
}
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
} else {
types.add(type);
}
ArcaneVault.setSelectedTypes(types);
ArcaneVault.setDirty(dtFlag);
}
Aggregations