Search in sources :

Example 11 with PreferenceManager

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();
    if (NodeType.DATABASE.equals(type)) {
        CubridServer server = node.getServer();
        QueryOptionPreferencePage queryEditorPage = new QueryOptionPreferencePage(server);
        PreferenceNode queryEditorNode = new PreferenceNode(com.cubrid.common.ui.query.Messages.queryTitle);
        queryEditorNode.setPage(queryEditorPage);
        mgr.addToRoot(queryEditorNode);
    }
    CMPreferenceDialog dlg = new CMPreferenceDialog(parentShell, mgr, Messages.titlePropertiesDialog);
    dlg.setPreferenceStore(CubridQueryUIPlugin.getDefault().getPreferenceStore());
    return dlg;
}
Also used : CMPreferenceDialog(com.cubrid.common.ui.spi.dialog.CMPreferenceDialog) PreferenceNode(org.eclipse.jface.preference.PreferenceNode) QueryOptionPreferencePage(com.cubrid.common.ui.query.preference.QueryOptionPreferencePage) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) PreferenceManager(org.eclipse.jface.preference.PreferenceManager)

Example 12 with PreferenceManager

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;
        }
        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());
        }
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) PreferenceManager(org.eclipse.jface.preference.PreferenceManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Example 13 with PreferenceManager

use of org.eclipse.jface.preference.PreferenceManager in project tdi-studio-se by Talend.

the class ProjectSettingDialog method open.

public void open(final String pageId) {
    PreferenceManager manager = getNodeManager();
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    final PreferenceDialog dialog = new ProjectSettingsPreferenceDialog(shell, manager);
    BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

        @Override
        public void run() {
            if (StringUtils.isNotEmpty(pageId)) {
                dialog.setSelectedNode(pageId);
            }
            dialog.create();
            dialog.getShell().setText(TITLE);
            dialog.getShell().setSize(DEFAULT_SIZE);
            dialog.open();
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) PreferenceManager(org.eclipse.jface.preference.PreferenceManager)

Aggregations

PreferenceManager (org.eclipse.jface.preference.PreferenceManager)13 IPreferenceNode (org.eclipse.jface.preference.IPreferenceNode)6 PreferenceNode (org.eclipse.jface.preference.PreferenceNode)4 CMPreferenceDialog (com.cubrid.common.ui.spi.dialog.CMPreferenceDialog)3 ArrayList (java.util.ArrayList)3 CoreException (org.eclipse.core.runtime.CoreException)3 QueryOptionPreferencePage (com.cubrid.common.ui.query.preference.QueryOptionPreferencePage)2 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)2 List (java.util.List)2 HsPreferenceDialog (net.heartsome.cat.common.ui.dialog.HsPreferenceDialog)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2 MenuManager (org.eclipse.jface.action.MenuManager)2 PreferenceDialog (org.eclipse.jface.preference.PreferenceDialog)2 PreferenceLabelProvider (org.eclipse.jface.preference.PreferenceLabelProvider)2 Image (org.eclipse.swt.graphics.Image)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ServerType (com.cubrid.cubridmanager.core.common.model.ServerType)1