本文整理汇总了Java中org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption类的典型用法代码示例。如果您正苦于以下问题:Java TemplateOption类的具体用法?Java TemplateOption怎么用?Java TemplateOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TemplateOption类属于org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates包,在下文中一共展示了TemplateOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName, String fileName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName);
}
else if(option.getName().equals(KEY_BASE_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName+"Base");
}
else if(option.getName().equals(KEY_MELANGE_FILE_NAME) && fileName != null){
option.setValue(fileName);
}
}
}
示例2: flagMissingRequiredOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.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 flagMissingRequiredOption(TemplateOption option) {
WizardPage page = null;
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
ArrayList<TemplateOption> list = tpage.options;
if (list.contains(option)) {
page = tpage.page;
break;
}
}
if (page != null) {
page.setPageComplete(false);
String message = NLS.bind(PDEUIMessages.OptionTemplateSection_mustBeSet, option.getMessageLabel());
page.setErrorMessage(message);
}
}
示例3: flagErrorOnOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Locates the page that this option is presented in and flags that the
* option has an error. The flagging is done by
* setting the page incomplete and setting the error message with the
* provided message prefixed by the option's message label.
*
* @param option
* the option that is required and currently not set
* @param msg
* the message indicating the error for the given option
*/
protected void flagErrorOnOption(TemplateOption option, String msg) {
WizardPage page = null;
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
ArrayList<TemplateOption> list = tpage.options;
if (list.contains(option)) {
page = tpage.page;
break;
}
}
if (page != null) {
page.setPageComplete(false);
String message = option.getMessageLabel()+": "+msg;
page.setErrorMessage(message);
}
}
示例4: createControl
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Creates the page control by creating individual options in the order
* subject to their position in the list.'
*
* @param composite
*/
public void createControl(Composite composite) {
Composite container = new Composite(composite, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.verticalSpacing = 9;
container.setLayout(layout);
for (int i = 0; i < options.size(); i++) {
TemplateOption option = (TemplateOption) options.get(i);
option.createControl(container, 3);
}
if (helpContextId != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId);
setControl(container);
Dialog.applyDialogFont(container);
container.forceFocus();
}
示例5: getStringOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns a string value of the option with a given name. The option with
* that name must exist and must be registered as a string option to begin
* with.
*
* @param name
* the unique name of the option
* @return the string value of the option with a given name or <samp>null
* </samp> if not found.
*/
public String getStringOption(String name) {
TemplateOption option = options.get(name);
if (option != null) {
if (option instanceof StringOption) {
return ((StringOption) option).getText();
} else if (option instanceof AbstractChoiceOption) {
// This situation covers both Combos and Radio buttons
Object value = option.getValue();
if (value instanceof String) {
return (String) value;
} else if (value != null) {
return value.toString();
}
}
}
return null;
}
示例6: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName, String fileName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_LANGUAGE_NAME) && languageName != null){
option.setValue(languageName);
}
else if(option.getName().equals(KEY_MELANGE_FILE_NAME) && fileName != null){
option.setValue(fileName);
}
}
}
示例7: validateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
@Override
public void validateOptions(TemplateOption source) {
super.validateOptions(source);
if( source.getName().contentEquals(KEY_LANGUAGE_NAME)){
String langName = getStringOption(KEY_LANGUAGE_NAME);
if(langName!=null && !langName.isEmpty() && !Character.isUpperCase(langName.charAt(0))){
flagErrorOnOption(source, WizardTemplateMessages.FirstCharUpperError);
}
}
}
示例8: getOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns options that belong to the page with the given index.
*
* @param pageIndex
* 0-based index of the template page
* @return @see #setPageCount(int)
*/
public TemplateOption[] getOptions(int pageIndex) {
if (pageIndex < 0 || pageIndex >= pages.size())
return new TemplateOption[0];
TemplatePage page = pages.get(pageIndex);
return page.options.toArray(new TemplateOption[page.options.size()]);
}
示例9: getPageIndex
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Returns the zero-based index of a page that hosts the the given option.
*
* @param option
* template option for which a page index is being requested
* @return zero-based index of a page that hosts the option or -1 if none of
* the pages contain the option.
*/
public int getPageIndex(TemplateOption option) {
for (int i = 0; i < pages.size(); i++) {
TemplatePage tpage = pages.get(i);
if (tpage.options.contains(option))
return i;
}
return -1;
}
示例10: registerOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
protected void registerOption(TemplateOption option, Object value, int pageIndex) {
super.registerOption(option, value, pageIndex);
if (pageIndex >= 0 && pageIndex < pages.size()) {
TemplatePage tpage = pages.get(pageIndex);
tpage.options.add(option);
}
}
示例11: validateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
/**
* Validate options given a template option
*
* @param source the template option to validate
*/
public void validateOptions(TemplateOption source) {
if (source.isRequired() && source.isEmpty()) {
flagMissingRequiredOption(source);
}
validateContainerPage(source);
}
示例12: validateContainerPage
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private void validateContainerPage(TemplateOption source) {
TemplateOption[] allPageOptions = getOptions(0);
for (int i = 0; i < allPageOptions.length; i++) {
TemplateOption nextOption = allPageOptions[i];
if (nextOption.isRequired() && nextOption.isEmpty()) {
flagMissingRequiredOption(nextOption);
return;
}
}
resetPageState();
}
示例13: updateOptions
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public void updateOptions(String packageName, String languageName){
TemplateOption[] allOptions = getOptions(0);
for(TemplateOption option : allOptions){
if(option.getName().equals(KEY_PACKAGE_NAME) && packageName != null){
option.setValue(packageName);
}
else if(option.getName().equals(KEY_METAMODEL_NAME) && languageName != null){
option.setValue(languageName);
}
}
}
示例14: TemplatePage
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
public TemplatePage() {
options = new ArrayList<TemplateOption>();
}
示例15: getOption
import org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption; //导入依赖的package包/类
private TemplateOption getOption(String key) {
return options.get(key);
}