当前位置: 首页>>代码示例>>Java>>正文


Java TemplateOption类代码示例

本文整理汇总了Java中org.eclipse.pde.ui.templates.TemplateOption的典型用法代码示例。如果您正苦于以下问题:Java TemplateOption类的具体用法?Java TemplateOption怎么用?Java TemplateOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TemplateOption类属于org.eclipse.pde.ui.templates包,在下文中一共展示了TemplateOption类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flagErrorMessage

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
 * Locates the page that this option is presented in and flags that the
 * option is required and is currently not set. The flagging is done by
 * setting the page incomplete and setting the error message that uses
 * option's message label.
 *
 * @param option
 *            the option that is required and currently not set
 */
protected void flagErrorMessage ( final TemplateOption option, final String newMessage, final int newType )
{
    for ( int i = 0; i < getPageCount (); i++ )
    {
        final WizardPage page = getPage ( i );
        for ( final TemplateOption pageOption : getOptions ( i ) )
        {
            if ( pageOption.equals ( option ) )
            {
                page.setPageComplete ( false );
                page.setMessage ( newMessage, newType );
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:25,代码来源:BaseTemplate.java

示例2: addPages

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
@Override
public void addPages(Wizard wizard) {
	addOptions();

	WizardPage page = new OptionTemplateWizardPage(this, new ArrayList<TemplateOption>(options.keySet()), null);
	page.setTitle(template.getName());
	pages.add(page);
	wizard.addPage(page);

	validateOptions(null);
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:12,代码来源:ProjectTemplateSection.java

示例3: addOptions

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private void addOptions() {
	addOption(KEY_PLUGIN_ID, "Project name:", "", 0);
	for (ParameterDescriptor param : template.getParameters()) {
		TemplateOption option = templateOptionFactory.createTemplateOption(this, param);
		registerOption(option, option.getValue(), 0);
		options.put(option, param);
	}
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:9,代码来源:ProjectTemplateSection.java

示例4: finish

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void finish() {
	replacementStrings.put(KEY_PACKAGE_NAME, String.valueOf(getValue(KEY_PLUGIN_ID)));

	for (Entry<TemplateOption, ParameterDescriptor> entry : options.entrySet()) {
		TemplateOption templateOption = entry.getKey();
		ParameterDescriptor descriptor = entry.getValue();
		if (descriptor == null) {
			continue;
		}

		Object value = templateOption.getValue();
		if (!(value instanceof String)) {
			continue;
		}

		String valueString = (String) value;
		replacementStrings.put(templateOption.getName() + UNMAPPED_VALUE_SUFFIX, valueString);
		ParameterMapping valueMapping = descriptor.getValueMapping();
		String newValue = valueString.replaceAll(valueMapping.getPattern(), valueMapping.getReplacement());
		templateOption.setValue(newValue);

		addStringMappings(templateOption.getName(), valueString);

		ParameterPreference preference = descriptor.getPreference();
		if (preference != null) {
			IPersistentPreferenceStore preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE,
					preference.getPluginId());
			preferences.setValue(preference.getPreferenceName(), valueString);
			try {
				preferences.save();
			} catch (IOException e) {
				ProjectTemplateActivator.logError("Failed to save preference", e);
			}
		}
	}
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:37,代码来源:ProjectTemplateSection.java

示例5: validateOptions

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
@Override
public void validateOptions(TemplateOption changed) {
	WizardPage page = getPage(0);

	for (TemplateOption option : options.keySet()) {
		if (option.isRequired() && option.isEmpty()) {
			page.setPageComplete(false);
			page.setErrorMessage("Required information is missing");
			return;
		}
	}

	page.setPageComplete(true);
	page.setErrorMessage(null);
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:16,代码来源:ProjectTemplateSection.java

示例6: createTemplateOption

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public TemplateOption createTemplateOption(BaseOptionTemplateSection section, ParameterDescriptor descriptor) {
	String name = descriptor.getName();
	String label = descriptor.getLabel() + ":";
	ParameterType type = descriptor.getType();

	TemplateOption templateOption;
	if (type == ParameterType.STRING) {
		templateOption = new StringOption(section, name, label);
	} else if (type == ParameterType.DIRECTORY) {
		templateOption = new DirectoryOption(section, name, label);
	} else if (type == ParameterType.SELECT) {
		templateOption = new ComboChoiceOption(section, name, label, getOptions(descriptor));
	} else if (type == ParameterType.COMBO) {
		templateOption = new EditableComboChoiceOption(section, name, label, getOptions(descriptor));
	} else if (type == ParameterType.WORKINGSET) {
		templateOption = new EditableComboChoiceOption(section, name, label, getWorkingSetOptions(descriptor));
	} else if (type == ParameterType.HIDDEN) {
		templateOption = new HiddenTemplateOption(section, name);
	} else {
		throw new UnsupportedOperationException("Unsupported parameter type: " + type);
	}

	String preferenceValue = getPreferenceValue(descriptor);
	String defaultValue = descriptor.getDefaultValue();
	String selectionValue = getFromSelection(descriptor);
	if (preferenceValue != null) {
		templateOption.setValue(preferenceValue);
	} else if (defaultValue != null) {
		templateOption.setValue(defaultValue);
	} else if (selectionValue != null) {
		templateOption.setValue(selectionValue);
	}

	templateOption.setRequired(true);

	return templateOption;
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:38,代码来源:TemplateOptionFactory.java

示例7: registerOption

import org.eclipse.pde.ui.templates.TemplateOption; //导入依赖的package包/类
@Override
protected void registerOption(TemplateOption option, Object value, int pageIndex) {
	super.registerOption(option, value, pageIndex);
	options.put(option, null);
}
 
开发者ID:secondfiddle,项目名称:pep-tools,代码行数:6,代码来源:ProjectTemplateSection.java


注:本文中的org.eclipse.pde.ui.templates.TemplateOption类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。