*
*/
-package org.tizen.emulator.manager.ui.renewal.tableviewer;
+package org.tizen.emulator.manager.ui.renewal.dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.renewal.resources.FontResources;
import org.tizen.emulator.manager.ui.renewal.MainDialog;
import org.tizen.emulator.manager.ui.renewal.widgets.CustomScrolledComposite;
-import org.tizen.emulator.manager.ui.renewal.widgets.GrayButton;
public class MessageBox {
private final int MIN_WIDTH = 300;
private final int MAX_HEIGHT = 400;
private final int TITLE_HEIGHT = 30;
+ private final int TITLE_MARGIN_TOP = 7;
+ private final int TITLE_MARGIN_LEFT = 15;
+
private final int BOTTOM_HEIGHT = 40;
private final int BUTTON_WIDTH = 80;
private final int BUTTON_HEIGHT = 26;
private boolean isOpen = false;
private int returnValue = SWT.OK;
- private StyledText titleLabel = null;
+ private Label titleLabel = null;
private CustomScrolledComposite scrolledList = null;
private StyledText contentsBox = null;
+ private Composite titleComp = null;
+
// TODO: Icon SWT.ICON_ERROR ...
private static final Shell shell;
static {
// need dialog size
makeButtons();
- titleLabel.setBounds(0, 0, width, TITLE_HEIGHT);
+ titleComp.setBounds(0, 0, width, TITLE_HEIGHT);
scrolledList.setBounds(0, TITLE_HEIGHT, width, height - TITLE_HEIGHT - BOTTOM_HEIGHT);
}
private void makeTitleLabel() {
- titleLabel = new StyledText(dialog, SWT.NONE);
+ titleComp = new Composite(dialog, SWT.NONE);
+ titleComp.setBackground(ColorResources.MESSAGE_BOX_TITLE_BG.getColor());
+ titleComp.setLayout(new FormLayout());
+
+ titleLabel = new Label(titleComp, SWT.NONE);
titleLabel.setText(this.title);
titleLabel.setBackground(ColorResources.MESSAGE_BOX_TITLE_BG.getColor());
titleLabel.setForeground(ColorResources.MESSAGE_BOX_TITLE_FONT.getColor());
titleLabel.setFont(FontResources.MESSAGE_BOX_TITLE.getFont());
- titleLabel.setLeftMargin(SPACING);
- titleLabel.setTopMargin(7);
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, TITLE_MARGIN_TOP);
+ data.left = new FormAttachment(0, TITLE_MARGIN_LEFT);
+ titleLabel.setLayoutData(data);
+
+ // make title drag-able
+ DragHandler.set(dialog, null, titleLabel, titleComp);
}
private void makeContentsBox() {
private int buttonCount = 1;
private void makeButton(String text, final int buttonType) {
if ((style & buttonType) == buttonType) {
- GrayButton button = new GrayButton(dialog, SWT.PUSH);
+ Button button = new Button(dialog, SWT.PUSH);
button.setFont(FontResources.GRAY_BTN_FONT.getFont());
button.setText(text);
button.setBackground(null);
import org.tizen.emulator.manager.renewal.resources.PatchImageResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.renewal.MainDialog;
+import org.tizen.emulator.manager.ui.renewal.dialog.MessageBox;
import org.tizen.emulator.manager.ui.renewal.dialoghandler.DeviceTemplateDialogHandler;
import org.tizen.emulator.manager.ui.renewal.widgets.Hyperlink;
import org.tizen.emulator.manager.ui.renewal.widgets.ImageButton;
DeviceTemplate template = (DeviceTemplate)item.getData();
try {
template.delete();
- table.remove(table.indexOf(item));
+ int index = table.indexOf(item);
+ table.remove(index);
+ if (table.getItemCount() > 0) {
+ if (index == table.getItemCount()) {
+ table.setSelection(index - 1);
+ } else {
+ table.setSelection(index);
+ }
+ }
} catch (DeviceWorkerException e) {
EMLogger.getLogger().warning(e.getMessage());
// open message box