use of org.eclipse.jface.preference.PreferenceNode in project cubrid-manager by CUBRID.
the class PreferenceNodeComparator method compare.
/**
* Compare object
*
* @param o1 Object
* @param o2 Object
*
* @return int
*/
public int compare(Object o1, Object o2) {
PreferenceNode node1 = null;
PreferenceNode node2 = null;
if (o1 instanceof PreferenceNode) {
node1 = (PreferenceNode) o1;
}
if (o2 instanceof PreferenceNode) {
node2 = (PreferenceNode) o2;
}
int retValue = compareNullObj(node1, node2);
if (retValue != 2) {
return retValue;
}
String id1 = node1.getId();
String id2 = node2.getId();
retValue = compareNullObj(id1, id2);
if (retValue != 2) {
return retValue;
}
return compareId(id1, id2);
}
use of org.eclipse.jface.preference.PreferenceNode in project translationstudio8 by heartsome.
the class ProjectSettingHandler method execute.
/**
* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
runWizardPageExtension();
ISelection curSelection = HandlerUtil.getCurrentSelection(event);
if (curSelection != null && !curSelection.isEmpty() && curSelection instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) curSelection;
Object obj = selection.getFirstElement();
if (obj instanceof IProject) {
IProject project = (IProject) obj;
ProjectConfiger cfg = ProjectConfigerFactory.getProjectConfiger(project);
final ProjectInfoBean cfgBean = cfg.getCurrentProjectConfig();
cfgBean.setProjectName(project.getName());
ProjectSettingBaseInfoPage infoPage = new ProjectSettingBaseInfoPage(cfgBean);
ProjectSettingLanguagePage langPag = new ProjectSettingLanguagePage(cfgBean);
final PreferenceManager mgr = new PreferenceManager();
IPreferenceNode infoNode = new PreferenceNode("infoPage", infoPage);
IPreferenceNode langNode = new PreferenceNode("langPag", langPag);
mgr.addToRoot(infoNode);
mgr.addTo("infoPage", langNode);
AbstractProjectSettingPage pageTm = getPageByType("TM");
if (pageTm != null) {
pageTm.setProjectInfoBean(cfgBean);
IPreferenceNode extensionNode = new PreferenceNode("tmInfo", pageTm);
mgr.addTo("infoPage", extensionNode);
}
AbstractProjectSettingPage pageTb = getPageByType("TB");
if (pageTb != null) {
pageTb.setProjectInfoBean(cfgBean);
IPreferenceNode extensionNode = new PreferenceNode("tbInfo", pageTb);
mgr.addTo("infoPage", extensionNode);
}
for (AbstractProjectSettingPage page : extensionPages) {
page.setProjectInfoBean(cfgBean);
IPreferenceNode extensionNode = new PreferenceNode("tbInfo", page);
mgr.addTo("infoPage", extensionNode);
}
ProjectSettingDialog dialog = new ProjectSettingDialog(window.getShell(), mgr);
dialog.create();
dialog.setMessage(infoPage.getTitle());
if (dialog.open() == 0) {
cfg.updateProjectConfig(cfgBean);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
logger.error("", e);
}
}
} else {
MessageDialog.openError(window.getShell(), Messages.getString("handlers.ProjectSettingHandler.msgTitle"), Messages.getString("handlers.ProjectSettingHandler.msg1"));
return null;
}
} else {
MessageDialog.openError(window.getShell(), Messages.getString("handlers.ProjectSettingHandler.msgTitle"), Messages.getString("handlers.ProjectSettingHandler.msg1"));
return null;
}
return null;
}
use of org.eclipse.jface.preference.PreferenceNode in project cubrid-manager by CUBRID.
the class PreferenceUtil method createPropertyDialog.
/**
* Create property dialog related with CUBRID node
*
* @param parentShell the parent shell
* @param node the ICubridNode object
* @return the Dialog object
*/
public static Dialog createPropertyDialog(Shell parentShell, ICubridNode node) {
PreferenceManager mgr = new PreferenceManager();
String type = node.getType();
ServerType serverType = node.getServer().getServerInfo().getServerType();
if (CubridNodeType.SERVER.equals(type)) {
// cubrid manager server property
ServerConfigPropertyPage cmServerPropertyPage = new ServerConfigPropertyPage(node, Messages.msgCmServerPropertyPageName);
PreferenceNode cmServerNode = new PreferenceNode(Messages.msgCmServerPropertyPageName);
cmServerNode.setPage(cmServerPropertyPage);
mgr.addToRoot(cmServerNode);
PreferenceNode categoryNode = createCategoryNode(Messages.msgConfigureParameterPageName, Messages.msgConfigureParameterPageName, Messages.msgDetailConfigureParameter);
mgr.addToRoot(categoryNode);
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
// service node
ServicePropertyPage servicePorpertyPage = new ServicePropertyPage(node, Messages.msgServicePropertyPageName);
PreferenceNode serviceNode = new PreferenceNode(Messages.msgServicePropertyPageName);
serviceNode.setPage(servicePorpertyPage);
categoryNode.add(serviceNode);
// database server node
DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
databaseServerNode.setPage(databaseServerPorpertyPage);
categoryNode.add(databaseServerNode);
// HA configuraiton
if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
HAPropertyPage haPropertyPage = new HAPropertyPage(node, Messages.msgHAPropertyPageName);
PreferenceNode haNode = new PreferenceNode(Messages.msgHAPropertyPageName);
haNode.setPage(haPropertyPage);
categoryNode.add(haNode);
}
}
if (serverType == ServerType.BOTH || serverType == ServerType.BROKER) {
// brokers node
BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
brokersParameterNode.setPage(brokersParameterPorpertyPage);
categoryNode.add(brokersParameterNode);
}
// mananger node
ManagerServerPropertyPage managerPorpertyPage = new ManagerServerPropertyPage(node, Messages.msgManagerPropertyPageName);
PreferenceNode managerNode = new PreferenceNode(Messages.msgManagerPropertyPageName);
managerNode.setPage(managerPorpertyPage);
categoryNode.add(managerNode);
// query editor node
if (serverType == ServerType.BOTH || serverType == ServerType.DATABASE) {
CubridServer server = node.getServer();
QueryOptionPreferencePage queryEditorPage = new QueryOptionPreferencePage(server);
PreferenceNode queryEditorNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
queryEditorNode.setPage(queryEditorPage);
mgr.addToRoot(queryEditorNode);
}
} else if (CubridNodeType.DATABASE_FOLDER.equals(type)) {
// database server node
DatabaseConfigPropertyPage databaseServerPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerCommonPropertyPageName, true);
PreferenceNode databaseServerNode = new PreferenceNode(Messages.msgDatabaseServerCommonPropertyPageName);
databaseServerNode.setPage(databaseServerPorpertyPage);
mgr.addToRoot(databaseServerNode);
} else if (CubridNodeType.DATABASE.equals(type)) {
// database parameter
DatabaseConfigPropertyPage databaseParameterPorpertyPage = new DatabaseConfigPropertyPage(node, Messages.msgDatabaseServerPropertyPageName, false);
PreferenceNode databaseParameterNode = new PreferenceNode(Messages.msgDatabaseServerPropertyPageName);
databaseParameterNode.setPage(databaseParameterPorpertyPage);
// database query
CubridDatabase database = (CubridDatabase) node;
DatabaseConnectionPropertyPage page = new DatabaseConnectionPropertyPage(database, Messages.msgQueryPropertyPageName);
PreferenceNode queryNode = new PreferenceNode(Messages.msgQueryPropertyPageName);
queryNode.setPage(page);
mgr.addToRoot(queryNode);
mgr.addToRoot(databaseParameterNode);
} else if (CubridNodeType.BROKER_FOLDER.equals(type)) {
// brokers node
BrokersParameterPropertyPage brokersParameterPorpertyPage = new BrokersParameterPropertyPage(node, Messages.msgBrokerPropertyPageName);
PreferenceNode brokersParameterNode = new PreferenceNode(Messages.msgBrokerPropertyPageName);
brokersParameterNode.setPage(brokersParameterPorpertyPage);
mgr.addToRoot(brokersParameterNode);
}
if (CubridNodeType.BROKER.equals(type)) {
BrokerParameterPropertyPage brokerParameterPorpertyPage = new BrokerParameterPropertyPage(node, node.getLabel());
PreferenceNode brokerParameterNode = new PreferenceNode(node.getLabel());
brokerParameterNode.setPage(brokerParameterPorpertyPage);
mgr.addToRoot(brokerParameterNode);
} else if (CubridNodeType.SHARD_FOLDER.equals(type)) {
ShardsParameterPropertyPage shardsParameterPorpertyPage = new ShardsParameterPropertyPage(node, node.getName());
PreferenceNode shardsParameterNode = new PreferenceNode(Messages.msgShardsFolderName);
shardsParameterNode.setPage(shardsParameterPorpertyPage);
mgr.addToRoot(shardsParameterNode);
} else if (CubridNodeType.SHARD.equals(type)) {
ShardParameterPropertyPage shardParameterPorpertyPage = new ShardParameterPropertyPage(node, node.getName());
PreferenceNode shardParameterNode = new PreferenceNode(node.getName());
shardParameterNode.setPage(shardParameterPorpertyPage);
mgr.addToRoot(shardParameterNode);
}
CMPreferenceDialog dlg = new CMPreferenceDialog(parentShell, mgr, Messages.titlePropertiesDialog);
dlg.setPreferenceStore(CubridManagerUIPlugin.getDefault().getPreferenceStore());
return dlg;
}
use of org.eclipse.jface.preference.PreferenceNode in project whole by wholeplatform.
the class PreferencesHandler method execute.
@Execute
public void execute(Shell shell) {
PreferenceManager manager = new PreferenceManager();
PreferenceNode wholeNode = new PreferenceNode(IE4UIConstants.WHOLE_PREFERENCE_PAGE_ID, new WholePreferencePage());
PreferenceNode editorNode = new PreferenceNode(IE4UIConstants.EDITOR_PREFERENCE_PAGE_ID, new EditorPreferencePage());
manager.addToRoot(wholeNode);
wholeNode.add(editorNode);
PreferenceDialog dialog = new PreferenceDialog(null, manager);
dialog.setSelectedNode(IE4UIConstants.EDITOR_PREFERENCE_PAGE_ID);
dialog.open();
}
use of org.eclipse.jface.preference.PreferenceNode in project portfolio by buchen.
the class OpenPreferenceDialogHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
PreferenceManager pm = new PreferenceManager();
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".updates", new UpdatePreferencePage()));
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".language", new LanguagePreferencePage()));
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".proxy", new ProxyPreferencePage()));
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".presentation", new PresentationPreferencePage()));
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".general", new GeneralPreferencePage()));
// $NON-NLS-1$
pm.addToRoot(new PreferenceNode(PortfolioPlugin.PLUGIN_ID + ".apikeys", new APIKeysPreferencePage()));
PreferenceDialog dialog = new PreferenceDialog(shell, pm);
dialog.setPreferenceStore(PortfolioPlugin.getDefault().getPreferenceStore());
dialog.create();
dialog.getTreeViewer().setComparator(new ViewerComparator());
dialog.getTreeViewer().expandAll();
dialog.open();
}
Aggregations