]> git.argeo.org Git - gpl/argeo-slc.git/blob - MarkAsRelevantCategory.java
e58aa1addc852fc452816d7fc522d3170726eaf0
[gpl/argeo-slc.git] / MarkAsRelevantCategory.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.client.ui.dist.commands;
17
18 import org.argeo.slc.client.ui.dist.DistPlugin;
19 import org.eclipse.core.commands.AbstractHandler;
20 import org.eclipse.core.commands.ExecutionEvent;
21 import org.eclipse.core.commands.ExecutionException;
22 import org.eclipse.jface.resource.ImageDescriptor;
23
24 /**
25 * Add the {@code SlcNames.SLC_RELEVANT_CATEGORY} mixin to the selected node
26 */
27 public class MarkAsRelevantCategory extends AbstractHandler {
28 // private static final Log log = LogFactory.getLog(DeleteWorkspace.class);
29
30 public final static String ID = DistPlugin.ID + ".markAsRelevantCategory";
31 public final static String DEFAULT_LABEL = "Mark as relevant category base";
32 public final static ImageDescriptor DEFAULT_ICON = DistPlugin
33 .getImageDescriptor("icons/addItem.gif");
34
35 public Object execute(ExecutionEvent event) throws ExecutionException {
36 // try {
37 // IWorkbenchPart activePart = DistPlugin.getDefault().getWorkbench()
38 // .getActiveWorkbenchWindow().getActivePage().getActivePart();
39 //
40 // if (activePart instanceof IEditorPart) {
41 // ISelection selector = ((IEditorPart) activePart)
42 // .getEditorSite().getSelectionProvider().getSelection();
43 // if (selector != null
44 // && selector instanceof IStructuredSelection) {
45 // Iterator<?> it = ((IStructuredSelection) selector)
46 // .iterator();
47 //
48 // Node node = (Node) it.next();
49 // if (node.isNodeType(SlcTypes.SLC_CATEGORY)) {
50 // String msg =
51 // "Your are about to unlist this category from the relevant category list for current workspace"
52 // + ".\n" + "Are you sure you want to proceed?";
53 // if (MessageDialog.openConfirm(DistPlugin.getDefault()
54 // .getWorkbench().getDisplay().getActiveShell(),
55 // "Confirm", msg)) {
56 // node.removeMixin(SlcTypes.SLC_CATEGORY);
57 // node.getSession().save();
58 // }
59 // } else {
60 // String msg =
61 // "Your are about to mark this group as category base in the current workspace"
62 // + ".\n" + "Are you sure you want to proceed?";
63 //
64 // if (MessageDialog.openConfirm(DistPlugin.getDefault()
65 // .getWorkbench().getDisplay().getActiveShell(),
66 // "Confirm", msg)) {
67 // node.addMixin(SlcTypes.SLC_CATEGORY);
68 // node.getSession().save();
69 // }
70 // }
71 // }
72 // }
73 // } catch (RepositoryException re) {
74 // throw new ArgeoException(
75 // "Unexpected error while deleting artifacts.", re);
76 // }
77 return null;
78 }
79 }