blob: 8ec7dcd8312b57ce2cb25bfdb6ab747505446746 [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2014, 2020 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.internal.eutils.autonature;
import java.util.List;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
public class ContentTypeConfig extends AutoConfig {
private final String contentTypeId;
private String label;
public ContentTypeConfig(final String contentTypeId, final List<Task> tasks) {
super(ConfigManager.ON_FILE_CONTENT_CONTRIB + ':' + contentTypeId, tasks);
this.contentTypeId= contentTypeId;
}
public String getContentTypeId() {
return this.contentTypeId;
}
@Override
public String getLabel() {
if (this.label == null) {
final IContentType contentType= Platform.getContentTypeManager().getContentType(this.contentTypeId);
if (contentType != null) {
this.label= contentType.getName();
}
}
return this.label;
}
}