Mercurial > hg > thermostat-tools-eclipse
view com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/CommandsMasterDetailsBlock.java @ 90:8f2dd0dbdb87
Externalize strings
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Tue, 21 Jan 2014 19:51:04 -0500 |
parents | b788a26c0d4d |
children | 1c835942f3c2 |
line wrap: on
line source
package com.redhat.thermostat.tools.eclipse.plugin.editor; import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.forms.DetailsPart; import org.eclipse.ui.forms.editor.FormPage; import com.redhat.thermostat.tools.eclipse.plugin.Messages; import com.redhat.thermostat.tools.eclipse.plugin.model.Command; import com.redhat.thermostat.tools.eclipse.plugin.model.Plugin; public class CommandsMasterDetailsBlock extends BaseMasterDetailsBlock { private CommandEditPage editPage; public CommandsMasterDetailsBlock(FormPage formPage) { editPage = new CommandEditPage(formPage); } public void setModel(Plugin model) { super.setModel(model); editPage.setModel(model); } @Override protected void registerPages(DetailsPart detailsPart) { detailsPart.registerPage(String.class, editPage); } @Override String getSectionTitle() { return Messages.CommandsMasterDetailsBlock_title; } @Override Object[] getListViewModel() { return model.getCommandNames().toArray(); } @Override void addButtonSelected(Shell shell) { NewNameDialog dialog = new NewNameDialog(shell); dialog.create(); if (dialog.open() == Window.OK) { Command command = new Command(); command.setName(dialog.getName()); model.addCommand(command); } } @Override void removeButtonSelected(Object selectedItem) { model.removeCommand((String) selectedItem); }; }