use of org.eclipse.jface.preference.PreferenceManager in project cubrid-manager by CUBRID.
the class ApplicationWorkbenchAdvisor method postStartup.
@Override
public void postStartup() {
super.postStartup();
/*Remove the help content in preference*/
PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
pm.remove("org.eclipse.help.ui.browsersPreferencePage");
}
use of org.eclipse.jface.preference.PreferenceManager 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.PreferenceManager in project cubrid-manager by CUBRID.
the class ApplicationWorkbenchWindowAdvisor method removePlatformDependencyActions.
private void removePlatformDependencyActions() {
// remove some menu items
IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
for (IContributionItem item : mm.getItems()) {
if (item == null) {
continue;
}
if (item instanceof MenuManager) {
MenuManager sm = (MenuManager) item;
for (IContributionItem sitem : sm.getItems()) {
if (sitem == null || sitem.getId() == null) {
continue;
}
if (sitem.getId().equals("org.eclipse.ui.actions.showKeyAssistHandler") || sitem.getId().equals("com.cubrid.common.update.p2.menu.install") || sitem.getId().equals("converstLineDelimitersTo") || sitem.getId().equals("save.ext") || sitem.getId().equals("org.eclipse.ui.openLocalFile") || sitem.getId().equals("new.ext")) {
sm.remove(sitem.getId());
sm.update(true);
mm.update(true);
}
}
}
}
// remove some tool bar items
ICoolBarManager cm = getWindowConfigurer().getActionBarConfigurer().getCoolBarManager();
for (IContributionItem item : cm.getItems()) {
if (item == null || item.getId() == null) {
continue;
}
if (item.getId().equals("org.eclipse.ui.edit.text.actionSet.annotationNavigation") || item.getId().equals("org.eclipse.ui.edit.text.actionSet.navigation")) {
cm.remove(item.getId());
cm.update(true);
}
}
// remove some preference items
PreferenceManager pm = getWindowConfigurer().getWindow().getWorkbench().getPreferenceManager();
for (IPreferenceNode item : pm.getRootSubNodes()) {
if (item.getId().equals("org.eclipse.help.ui.browsersPreferencePage") || item.getId().equals("org.eclipse.ui.preferencePages.Workbench")) {
pm.remove(item.getId());
}
}
}
use of org.eclipse.jface.preference.PreferenceManager in project cubrid-manager by CUBRID.
the class OpenPreferenceAction method run.
/**
* Open preference dialog
*/
@SuppressWarnings("restriction")
public void run() {
PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
//Delete the security storage category
preferenceManager.remove("org.eclipse.equinox.security.ui.category");
String title = this.getText().replaceAll("&", "").replaceAll("\\.", "");
CMPreferenceDialog dialog = new CMPreferenceDialog(shell, preferenceManager, title);
dialog.create();
dialog.open();
}
use of org.eclipse.jface.preference.PreferenceManager in project azure-tools-for-java by Microsoft.
the class PluginUtil method openPropertyPageDialog.
/**
* Method opens property dialog with only desired property page.
*
* @param nodeId
* : Node ID of property page
* @param nodeLbl
* : Property page name
* @param classObj
* : Class object of property page
* @return
*/
public static int openPropertyPageDialog(String nodeId, String nodeLbl, Object classObj) {
// value corresponding to cancel
int retVal = Window.CANCEL;
// Node creation
try {
PreferenceNode nodePropPg = new PreferenceNode(nodeId, nodeLbl, null, classObj.getClass().toString());
nodePropPg.setPage((IPreferencePage) classObj);
nodePropPg.getPage().setTitle(nodeLbl);
PreferenceManager mgr = new PreferenceManager();
mgr.addToRoot(nodePropPg);
// Dialog creation
PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr);
// make desired property page active.
dialog.setSelectedNode(nodeLbl);
dialog.create();
/*
* If showing storage accounts preference page, don't show
* properties for title as its common repository.
*/
String dlgTitle = "";
if (nodeLbl.equals(Messages.cmhLblStrgAcc) || nodeLbl.equals(Messages.aiTxt)) {
dlgTitle = nodeLbl;
} else {
dlgTitle = String.format(Messages.cmhPropFor, getSelectedProject().getName());
}
dialog.getShell().setText(dlgTitle);
dialog.open();
// return whether user has pressed OK or Cancel button
retVal = dialog.getReturnCode();
} catch (Exception e) {
PluginUtil.displayErrorDialogAndLog(PluginUtil.getParentShell(), Messages.rolsDlgErr, Messages.projDlgErrMsg, e);
}
return retVal;
}
Aggregations