1 /*******************************************************************************
2 * Copyright (c) 2000, 2010 QNX Software Systems and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * QNX Software Systems - Initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.cdt.ui;
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.eclipse.jface.resource.ImageDescriptor;
16 import org.eclipse.ui.model.IWorkbenchAdapter;
17 import org.eclipse.ui.model.WorkbenchAdapter;
21 public abstract class CElementGrouping extends WorkbenchAdapter implements IAdaptable {
23 public final static int INCLUDES_GROUPING = 0x00001;
28 public final static int MACROS_GROUPING = 0x00011;
30 public final static int NAMESPACE_GROUPING = 0x00010;
31 public final static int CLASS_GROUPING = 0x00100;
32 public final static int LIBRARY_REF_CONTAINER = 0x01000;
33 public final static int INCLUDE_REF_CONTAINER = 0x10000;
37 public CElementGrouping(int type) {
41 public int getType() {
46 * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
49 public String getLabel(Object object) {
51 case INCLUDES_GROUPING:
52 return Messages.CElementGrouping_includeGroupingLabel;
54 return Messages.CElementGrouping_macroGroupingLabel;
56 return super.getLabel(object);
60 * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
63 public ImageDescriptor getImageDescriptor(Object object) {
65 case INCLUDES_GROUPING:
66 return CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_INCCONT);
67 case NAMESPACE_GROUPING:
68 return CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_NAMESPACE);
70 return CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_CLASS);
72 return CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_MACRO);
74 return super.getImageDescriptor(object);
78 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
80 @SuppressWarnings("rawtypes")
81 public Object getAdapter(Class clas) {
82 if (clas == IWorkbenchAdapter.class)
88 * @see java.lang.Object#toString()
91 public String toString() {
92 return getLabel(null);