-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.client.ui.commands;\r
-\r
-import java.util.Iterator;\r
-\r
-import org.argeo.slc.client.ui.ClientUiPlugin;\r
-import org.argeo.slc.client.ui.model.ResultParent;\r
-import org.argeo.slc.client.ui.views.JcrResultTreeView;\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-/**\r
- * Force refresh the ResultTreeView. This command is only intended to be called\r
- * by either the toolbar menu of the view or by the popup menu. Refresh due to\r
- * data changes must be triggered by Observers\r
- */\r
-public class RefreshJcrResultTreeView extends AbstractHandler {\r
- public final static String ID = ClientUiPlugin.ID\r
- + ".refreshJcrResultTreeView";\r
- public final static String PARAM_REFRESH_TYPE = ClientUiPlugin.ID\r
- + ".param.refreshType";\r
- public final static String PARAM_REFRESH_TYPE_FULL = "fullRefresh";\r
- public final static ImageDescriptor DEFAULT_IMG_DESCRIPTOR = ClientUiPlugin\r
- .getImageDescriptor("icons/refresh.png");\r
- public final static String DEFAULT_LABEL = "Refresh selected";\r
-\r
- public Object execute(final ExecutionEvent event) throws ExecutionException {\r
- String refreshType = event.getParameter(PARAM_REFRESH_TYPE);\r
- JcrResultTreeView view = (JcrResultTreeView) HandlerUtil\r
- .getActiveWorkbenchWindow(event).getActivePage()\r
- .getActivePart();\r
-\r
- // force full refresh without preserving selection from the tool bar\r
- if (PARAM_REFRESH_TYPE_FULL.equals(refreshType))\r
- view.refresh(null);\r
- else {\r
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil\r
- .getActiveWorkbenchWindow(event).getActivePage()\r
- .getSelection();\r
- @SuppressWarnings("rawtypes")\r
- Iterator it = selection.iterator();\r
- while (it.hasNext()) {\r
- Object obj = it.next();\r
- if (obj instanceof ResultParent) {\r
- view.refresh((ResultParent) obj);\r
- }\r
- }\r
- }\r
- return null;\r
- }\r
-}\r
+package org.argeo.slc.client.ui.commands;
+
+import java.util.Iterator;
+
+import org.argeo.slc.client.ui.ClientUiPlugin;
+import org.argeo.slc.client.ui.model.ResultParent;
+import org.argeo.slc.client.ui.views.JcrResultTreeView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Force refresh the ResultTreeView. This command is only intended to be called
+ * by either the toolbar menu of the view or by the popup menu. Refresh due to
+ * data changes must be triggered by Observers
+ */
+public class RefreshJcrResultTreeView extends AbstractHandler {
+ public final static String ID = ClientUiPlugin.ID
+ + ".refreshJcrResultTreeView";
+ public final static String PARAM_REFRESH_TYPE = ClientUiPlugin.ID
+ + ".param.refreshType";
+ public final static String PARAM_REFRESH_TYPE_FULL = "fullRefresh";
+ public final static ImageDescriptor DEFAULT_IMG_DESCRIPTOR = ClientUiPlugin
+ .getImageDescriptor("icons/refresh.png");
+ public final static String DEFAULT_LABEL = "Refresh selected";
+
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ String refreshType = event.getParameter(PARAM_REFRESH_TYPE);
+ JcrResultTreeView view = (JcrResultTreeView) HandlerUtil
+ .getActiveWorkbenchWindow(event).getActivePage()
+ .getActivePart();
+
+ // force full refresh without preserving selection from the tool bar
+ if (PARAM_REFRESH_TYPE_FULL.equals(refreshType))
+ view.refresh(null);
+ else {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil
+ .getActiveWorkbenchWindow(event).getActivePage()
+ .getSelection();
+ @SuppressWarnings("rawtypes")
+ Iterator it = selection.iterator();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj instanceof ResultParent) {
+ view.refresh((ResultParent) obj);
+ }
+ }
+ }
+ return null;
+ }
+}