blob: 80e1256a7c0e866ce2fa49ff2b7a37092392d710 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.common.snippets.internal.actions;
import org.eclipse.wst.common.snippets.core.ISnippetItem;
import org.eclipse.wst.common.snippets.core.ISnippetVariable;
import org.eclipse.wst.common.snippets.internal.palette.SnippetPaletteItem;
public class LibraryItemUtility {
public static void copyAttributes(ISnippetItem sourceItem, ISnippetItem targetItem) {
SnippetPaletteItem source = (SnippetPaletteItem) sourceItem;
SnippetPaletteItem target = (SnippetPaletteItem) targetItem;
target.setCategoryName(source.getCategoryName());
target.setClassName(source.getClassName());
target.setContentString(source.getContentString());
target.setDescription(source.getDescription());
target.setEditorClassName(source.getEditorClassName());
target.setIconName(source.getSmallIconName());
target.setId(source.getId());
target.setLabel(source.getLabel());
target.setLargeIconName(source.getLargeIconName());
target.setSourceDescriptor(source.getSourceDescriptor());
target.setSourceType(source.getSourceType());
target.setVisible(source.isVisible());
ISnippetVariable[] variables = target.getVariables();
for (int i = 0; i < variables.length; i++) {
target.removeVariable(variables[i]);
}
variables = source.getVariables();
for (int i = 0; i < variables.length; i++) {
target.addVariable(variables[i]);
}
}
}