@@ -0,0 +1,3115 @@
+/*******************************************************************************%0A * Copyright (c) 2010-2015, Embraer S.A., Budapest University of Technology and Economics%0A * All rights reserved. This program and the accompanying materials %0A * are made available under the terms of the Eclipse Public License v1.0 %0A * which accompanies this distribution, and is available at %0A * http://www.eclipse.org/legal/epl-v10.html %0A *%0A * Contributors: %0A *     Abel Hegedus - initial API and implementation %0A *******************************************************************************/%0Apackage hu.bme.mit.massif.simulink.presentation.handlers;%0A%0Aimport hu.bme.mit.massif.simulink.SimulinkElement;%0Aimport hu.bme.mit.massif.simulink.api.util.SimulinkUtil;%0Aimport hu.bme.mit.massif.simulink.presentation.SimulinkEditorPlugin;%0A%0Aimport org.eclipse.core.commands.AbstractHandler;%0Aimport org.eclipse.core.commands.ExecutionEvent;%0Aimport org.eclipse.core.commands.ExecutionException;%0Aimport org.eclipse.core.runtime.Status;%0Aimport org.eclipse.jface.dialogs.MessageDialog;%0Aimport org.eclipse.jface.viewers.ISelection;%0Aimport org.eclipse.jface.viewers.IStructuredSelection;%0Aimport org.eclipse.ui.handlers.HandlerUtil;%0A%0A/**%0A * @author Abel Hegedus%0A *%0A */%0Apublic class ResetQualifierHandler extends AbstractHandler %7B%0A%0A    @Override%0A    public Object execute(ExecutionEvent event) throws ExecutionException %7B%0A        ISelection selection = HandlerUtil.getCurrentSelection(event);%0A%0A        if (selection instanceof IStructuredSelection) %7B%0A            for (Object element : ((IStructuredSelection) selection).toList()) %7B%0A                if (element instanceof SimulinkElement) %7B%0A                    SimulinkElement slElem = (SimulinkElement) element;%0A                    String qualifier = slElem.getSimulinkRef().getQualifier();%0A                    %0A                    boolean resetRequested = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), %22Reset qualifier on chilren%22,%0A                            %22Do you want to reset the qualifier on children elements of %22 + slElem.getName() +%0A                            %22 based on %22 + qualifier + %22?%5CnResetting will be performed on all transitively contained elements.%22);%0A                    if(resetRequested) %7B%0A                        try %7B%0A                            SimulinkUtil.changeRootQualifier(slElem, qualifier);%0A                        %7D catch (IllegalArgumentException e) %7B%0A                            String errorMsg = %22Could not reset qualifier on children of %22 + slElem.getSimulinkRef().getFQN();%0A                            MessageDialog.openError(HandlerUtil.getActiveShell(event), %22Reset qualifier on children%22,%0A                                    errorMsg + %22:%5Cn%22 + e.getLocalizedMessage() + %22%5CnSee error log for details.%22);%0A                            Status status = new Status(Status.ERROR, SimulinkEditorPlugin.getPlugin().getSymbolicName(), errorMsg, e);%0A                            SimulinkEditorPlugin.getPlugin().getLog().log(status);%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%0A%7D%0A

fix #23 added reset qualifier menu and utility method