| /******************************************************************************* |
| * Copyright (c) 2006 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| * |
| *******************************************************************************/ |
| package org.eclipse.wst.dtd.ui.internal.properties.section; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.jface.viewers.ISelection; |
| import org.eclipse.jface.viewers.IStructuredSelection; |
| import org.eclipse.ui.IWorkbenchPart; |
| import org.eclipse.wst.common.ui.properties.internal.provisional.ISection; |
| import org.eclipse.wst.dtd.core.internal.CMBasicNode; |
| |
| public class ContentModelNameSectionDescriptor extends AbstractSectionDescriptor { |
| private ContentModelNameSection contentModelNameSection; |
| |
| public ContentModelNameSectionDescriptor() { |
| super(); |
| contentModelNameSection = new ContentModelNameSection(); |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId() |
| */ |
| public String getId() { |
| return "org.eclipse.wst.dtd.ui.internal.section.contentmodelname"; //$NON-NLS-1$ |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes() |
| */ |
| public List getInputTypes() { |
| List list = new ArrayList(); |
| return list; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass() |
| */ |
| public ISection getSectionClass() { |
| return contentModelNameSection; |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab() |
| */ |
| public String getTargetTab() { |
| return "org.eclipse.wst.dtd.ui.internal.general"; //$NON-NLS-1$ |
| } |
| |
| /* |
| * (non-Javadoc) |
| * |
| * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, |
| * org.eclipse.jface.viewers.ISelection) |
| */ |
| public boolean appliesTo(IWorkbenchPart part, ISelection selection) { |
| Object object = null; |
| if (selection instanceof IStructuredSelection) { |
| IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
| object = structuredSelection.getFirstElement(); |
| if (object instanceof CMBasicNode && !((CMBasicNode) object).isRootElementContent()) |
| return true; |
| else |
| return false; |
| } |
| return false; |
| } |
| |
| } |