1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.diagram.handler;
\r
14 import org.eclipse.core.commands.AbstractHandler;
\r
15 import org.eclipse.core.commands.ExecutionEvent;
\r
16 import org.eclipse.core.commands.ExecutionException;
\r
17 import org.eclipse.core.commands.IHandler;
\r
18 import org.eclipse.ui.IWorkbenchPart;
\r
19 import org.eclipse.ui.handlers.HandlerUtil;
\r
20 import org.eclipse.ui.part.IPage;
\r
21 import org.simantics.diagram.symbollibrary.ui.SymbolLibraryPage;
\r
22 import org.simantics.diagram.symbollibrary.ui.SymbolPageView;
\r
24 public class ExpandAll extends AbstractHandler implements IHandler {
\r
27 public Object execute(ExecutionEvent event) throws ExecutionException {
\r
29 IWorkbenchPart part = HandlerUtil.getActivePart(event);
\r
30 if(part == null) return null;
\r
31 if(part instanceof SymbolPageView) {
\r
32 SymbolPageView view = (SymbolPageView)part;
\r
33 IPage page = view.getCurrentPage();
\r
34 if(page == null) return null;
\r
35 if(page instanceof SymbolLibraryPage) {
\r
36 SymbolLibraryPage libraryPage = (SymbolLibraryPage)page;
\r
37 libraryPage.setAllExpandedStates(true);
\r