use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class ERSchema method getTableTreeNode.
public ICubridNode getTableTreeNode(String tableName) {
ICubridNode node = this.getCubridDatabase().getChild(getCubridDatabase().getId() + ICubridNodeLoader.NODE_SEPARATOR + CubridTablesFolderLoader.TABLES_FOLDER_ID);
if (node == null || !node.getLoader().isLoaded()) {
return null;
}
List<ICubridNode> tableNodes = node.getChildren();
for (ICubridNode tableNode : tableNodes) {
if (tableNode == null) {
continue;
}
if (tableNode.getName().equals(tableName)) {
return tableNode;
}
}
return null;
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class ERSchemaEditor method initializeGraphicalViewer.
protected void initializeGraphicalViewer() {
IEditorInput input = this.getEditorInput();
if (input instanceof ICubridNode) {
ICubridNode node = (ICubridNode) input;
ERSchema erSchema = (ERSchema) node.getAdapter(ERSchema.class);
getGraphicalViewer().setContents(erSchema);
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class CubridSPFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
// add function folder
String functionFolderId = parent.getId() + NODE_SEPARATOR + FUNCTION_FOLDER_ID;
ICubridNode functionFolder = parent.getChild(functionFolderId);
if (functionFolder == null) {
functionFolder = new DefaultSchemaNode(functionFolderId, FUNCTION_FOLDER_NAME, "icons/navigator/folder.png");
functionFolder.setType(NodeType.STORED_PROCEDURE_FUNCTION_FOLDER);
functionFolder.setContainer(true);
ICubridNodeLoader loader = new CubridFunctionFolderLoader();
loader.setLevel(getLevel());
functionFolder.setLoader(loader);
parent.addChild(functionFolder);
if (getLevel() == DEFINITE_LEVEL) {
functionFolder.getChildren(monitor);
}
} else {
if (functionFolder.getLoader() != null && functionFolder.getLoader().isLoaded()) {
functionFolder.getLoader().setLoaded(false);
functionFolder.getChildren(monitor);
}
}
// add procedure folder
String procedureFolderId = parent.getId() + NODE_SEPARATOR + PROCEDURE_FOLDER_ID;
ICubridNode procedureFolder = parent.getChild(procedureFolderId);
if (procedureFolder == null) {
procedureFolder = new DefaultSchemaNode(procedureFolderId, PROCEDURE_FOLDER_NAME, "icons/navigator/folder.png");
procedureFolder.setType(NodeType.STORED_PROCEDURE_PROCEDURE_FOLDER);
procedureFolder.setContainer(true);
ICubridNodeLoader loader = new CubridProcedureFolderLoader();
loader.setLevel(getLevel());
procedureFolder.setLoader(loader);
parent.addChild(procedureFolder);
if (getLevel() == DEFINITE_LEVEL) {
procedureFolder.getChildren(monitor);
}
} else {
if (procedureFolder.getLoader() != null && procedureFolder.getLoader().isLoaded()) {
procedureFolder.getLoader().setLoaded(false);
procedureFolder.getChildren(monitor);
}
}
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class CubridEditorPart method close.
/**
* close the editors which are the same server
* @param event
* @param database
*/
public void close(CubridNodeChangedEvent event, CubridServer server) {
ICubridNode cubridNode = event.getCubridNode();
CubridNodeChangedEventType eventType = event.getType();
if (cubridNode == null || eventType == null) {
return;
}
if (event.getSource() instanceof CubridServer) {
CubridServer eventCubridServer = (CubridServer) event.getSource();
if (eventCubridServer.equals(server)) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
window.getActivePage().closeEditor(this, true);
}
}
}
use of com.cubrid.common.ui.spi.model.ICubridNode in project cubrid-manager by CUBRID.
the class CubridEditorPart method init.
/**
* Initializes this editor with the given editor site and input.
*
* @param site the editor site
* @param input the editor input
* @exception PartInitException if this editor was not initialized
* successfully
*/
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
setInput(input);
if (input != null && input.getToolTipText() != null) {
setTitleToolTip(input.getToolTipText());
}
String title = this.getPartName();
CubridServer server = null;
String serverName = "";
String port = "";
if (input instanceof ICubridNode) {
cubridNode = (ICubridNode) input;
server = cubridNode.getServer();
if (null != server) {
serverName = server.getLabel();
port = server.getMonPort();
}
}
if (input != null) {
if (title == null) {
if (null == server) {
setPartName(input.getName());
} else {
setPartName(input.getName() + "@" + serverName + ":" + port);
}
} else {
if (null == server) {
setPartName(title + " - " + input.getName());
} else {
setPartName(title + " - " + input.getName() + "@" + serverName + ":" + port);
}
}
}
CubridNodeManager.getInstance().addCubridNodeChangeListener(this);
}
Aggregations