Search in sources :

Example 11 with IPreferenceNode

use of org.eclipse.jface.preference.IPreferenceNode 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());
        }
    }
}
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 12 with IPreferenceNode

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

the class ProjectSettingsPreferenceDialog method removeChildrenPreferenceNodes.

@Override
public boolean removeChildrenPreferenceNodes(String parentId, List<String> childrenIds) {
    IPreferenceNode findNodeMatching = findNodeMatching(parentId);
    if (findNodeMatching != null && childrenIds != null) {
        // remove existed nodes.
        List<IPreferenceNode> recordRemovedNodes = new ArrayList<IPreferenceNode>();
        boolean nonExisted = false;
        for (String childId : childrenIds) {
            IPreferenceNode removedNode = findNodeMatching.remove(childId);
            if (removedNode != null) {
                recordRemovedNodes.add(removedNode);
            } else {
                nonExisted = true;
                break;
            }
        }
        // add back the delete nodes
        if (nonExisted) {
            for (IPreferenceNode node : recordRemovedNodes) {
                findNodeMatching.add(node);
            }
            return false;
        } else {
            this.getTreeViewer().refresh();
            return true;
        }
    }
    return false;
}
Also used : ArrayList(java.util.ArrayList) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode)

Example 13 with IPreferenceNode

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

the class StandaloneJobRepositoryMavenSetting method createStandaloneJobChildrenNodes.

public static List<IPreferenceNode> createStandaloneJobChildrenNodes(IFolder nodeFolder, RepositoryNode node, String parentId, boolean checkExist) {
    List<IPreferenceNode> childrenNodes = new ArrayList<IPreferenceNode>();
    // if have existed the pom and assembly
    if (!checkExist || DesignerMavenUiHelper.existMavenSetting(nodeFolder, TalendMavenConstants.POM_FILE_NAME, TalendMavenConstants.ASSEMBLY_FILE_NAME)) {
        IFile pomTemplateFile = nodeFolder.getFile(TalendMavenConstants.POM_FILE_NAME);
        IFile assemblyTemplateFile = nodeFolder.getFile(TalendMavenConstants.ASSEMBLY_FILE_NAME);
        String pomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, pomTemplateFile);
        String assemblyId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, assemblyTemplateFile);
        StandaloneJobPomRepositorySettingNode pomNode = new StandaloneJobPomRepositorySettingNode(pomId, pomTemplateFile);
        StandaloneJobAssemblyRepositorySettingNode assemblyNode = new StandaloneJobAssemblyRepositorySettingNode(assemblyId, assemblyTemplateFile);
        childrenNodes.add(pomNode);
        childrenNodes.add(assemblyNode);
    }
    return childrenNodes;
}
Also used : IFile(org.eclipse.core.resources.IFile) StandaloneJobPomRepositorySettingNode(org.talend.designer.maven.job.setting.repository.standalone.node.StandaloneJobPomRepositorySettingNode) ArrayList(java.util.ArrayList) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) StandaloneJobAssemblyRepositorySettingNode(org.talend.designer.maven.job.setting.repository.standalone.node.StandaloneJobAssemblyRepositorySettingNode)

Aggregations

IPreferenceNode (org.eclipse.jface.preference.IPreferenceNode)13 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)6 ArrayList (java.util.ArrayList)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 List (java.util.List)2 HsPreferenceDialog (net.heartsome.cat.common.ui.dialog.HsPreferenceDialog)2 CoreException (org.eclipse.core.runtime.CoreException)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 IPreferencePage (org.eclipse.jface.preference.IPreferencePage)2 PreferenceLabelProvider (org.eclipse.jface.preference.PreferenceLabelProvider)2 ISelection (org.eclipse.jface.viewers.ISelection)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Image (org.eclipse.swt.graphics.Image)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 HashMap (java.util.HashMap)1 ProjectInfoBean (net.heartsome.cat.common.bean.ProjectInfoBean)1