Search in sources :

Example 1 with AbstractDropDownAction

use of com.archimatetool.editor.actions.AbstractDropDownAction in project archi by archimatetool.

the class SearchWidget method setupToolBar.

protected void setupToolBar() {
    fActionFilterName = new Action(Messages.SearchWidget_0, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setFilterOnName(isChecked());
        }
    };
    fActionFilterName.setToolTipText(Messages.SearchWidget_1);
    fActionFilterName.setChecked(true);
    fSearchFilter.setFilterOnName(true);
    fActionFilterDoc = new Action(Messages.SearchWidget_2, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setFilterOnDocumentation(isChecked());
        }
    };
    fActionFilterDoc.setToolTipText(Messages.SearchWidget_3);
    final ToolBarManager toolBarmanager = new ToolBarManager(SWT.FLAT);
    toolBarmanager.createControl(this);
    AbstractDropDownAction dropDownAction = new AbstractDropDownAction(Messages.SearchWidget_4) {

        @Override
        public void run() {
            showMenu(toolBarmanager);
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_FILTER);
        }
    };
    toolBarmanager.add(dropDownAction);
    // Name & Documentation
    dropDownAction.add(fActionFilterName);
    dropDownAction.add(fActionFilterDoc);
    // Properties
    fPropertiesMenu = new MenuManager(Messages.SearchWidget_5);
    dropDownAction.add(fPropertiesMenu);
    populatePropertiesMenu(fPropertiesMenu);
    dropDownAction.add(new Separator());
    MenuManager strategyMenu = new MenuManager(Messages.SearchWidget_15);
    dropDownAction.add(strategyMenu);
    for (EClass eClass : ArchimateModelUtils.getStrategyClasses()) {
        strategyMenu.add(createObjectAction(eClass));
    }
    MenuManager businessMenu = new MenuManager(Messages.SearchWidget_6);
    dropDownAction.add(businessMenu);
    for (EClass eClass : ArchimateModelUtils.getBusinessClasses()) {
        businessMenu.add(createObjectAction(eClass));
    }
    MenuManager applicationMenu = new MenuManager(Messages.SearchWidget_7);
    dropDownAction.add(applicationMenu);
    for (EClass eClass : ArchimateModelUtils.getApplicationClasses()) {
        applicationMenu.add(createObjectAction(eClass));
    }
    MenuManager technologyPhysicalMenu = new MenuManager(Messages.SearchWidget_8);
    dropDownAction.add(technologyPhysicalMenu);
    for (EClass eClass : ArchimateModelUtils.getTechnologyClasses()) {
        technologyPhysicalMenu.add(createObjectAction(eClass));
    }
    technologyPhysicalMenu.add(new Separator());
    for (EClass eClass : ArchimateModelUtils.getPhysicalClasses()) {
        technologyPhysicalMenu.add(createObjectAction(eClass));
    }
    MenuManager motivationMenu = new MenuManager(Messages.SearchWidget_9);
    dropDownAction.add(motivationMenu);
    for (EClass eClass : ArchimateModelUtils.getMotivationClasses()) {
        motivationMenu.add(createObjectAction(eClass));
    }
    MenuManager implementationMenu = new MenuManager(Messages.SearchWidget_10);
    dropDownAction.add(implementationMenu);
    for (EClass eClass : ArchimateModelUtils.getImplementationMigrationClasses()) {
        implementationMenu.add(createObjectAction(eClass));
    }
    MenuManager otherMenu = new MenuManager(Messages.SearchWidget_14);
    dropDownAction.add(otherMenu);
    for (EClass eClass : ArchimateModelUtils.getOtherClasses()) {
        otherMenu.add(createObjectAction(eClass));
    }
    otherMenu.add(new Separator());
    for (EClass eClass : ArchimateModelUtils.getConnectorClasses()) {
        otherMenu.add(createObjectAction(eClass));
    }
    MenuManager relationsMenu = new MenuManager(Messages.SearchWidget_11);
    dropDownAction.add(relationsMenu);
    for (EClass eClass : ArchimateModelUtils.getRelationsClasses()) {
        relationsMenu.add(createObjectAction(eClass));
    }
    dropDownAction.add(new Separator());
    IAction action = new Action(Messages.SearchWidget_12, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setShowAllFolders(isChecked());
        }
    };
    action.setChecked(fSearchFilter.isShowAllFolders());
    dropDownAction.add(action);
    dropDownAction.add(new Separator());
    action = new Action(Messages.SearchWidget_13) {

        @Override
        public void run() {
            reset();
        }
    };
    dropDownAction.add(action);
    toolBarmanager.update(true);
}
Also used : IAction(org.eclipse.jface.action.IAction) AbstractDropDownAction(com.archimatetool.editor.actions.AbstractDropDownAction) Action(org.eclipse.jface.action.Action) EClass(org.eclipse.emf.ecore.EClass) IAction(org.eclipse.jface.action.IAction) MenuManager(org.eclipse.jface.action.MenuManager) AbstractDropDownAction(com.archimatetool.editor.actions.AbstractDropDownAction) ToolBarManager(org.eclipse.jface.action.ToolBarManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

AbstractDropDownAction (com.archimatetool.editor.actions.AbstractDropDownAction)1 EClass (org.eclipse.emf.ecore.EClass)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1