本文整理汇总了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 );
}
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
示例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;
}
示例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);
}