Example usage for org.eclipse.jface.dialogs MessageDialog openQuestion

List of usage examples for org.eclipse.jface.dialogs MessageDialog openQuestion

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog openQuestion.

Prototype

public static boolean openQuestion(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a simple Yes/No question dialog.

Usage

From source file:com.google.dart.tools.ui.internal.preferences.DartKeyBindingPreferencePage.java

License:Open Source License

private void exportKeys() {
    String path = requestFilePath(SWT.SAVE, PreferencesMessages.DartKeyBindingPref_ChooseExportFile, SAVE_PATH);
    if (path == null) {
        return;/* w ww  .ja  va  2s.  c  om*/
    }
    File file = new File(path);
    if (file.exists() && !MessageDialog.openQuestion(getShell(),
            PreferencesMessages.DartKeyBindingPref_ExportTitle,
            Messages.format(PreferencesMessages.DartKeyBindingPref_ConfirmReplace, file.getAbsolutePath()))) {
        return;
    }
    try {
        DartKeyBindingPersistence persist;
        persist = new DartKeyBindingPersistence(activityManager, bindingService, commandService);
        persist.writeFile(file, getEncoding());
    } catch (CoreException ex) {
        String title = PreferencesMessages.DartKeyBindingPref_ExportTitle;
        String message = PreferencesMessages.DartKeyBindingPref_CouldNotExport;
        ExceptionHandler.handle(ex, getShell(), title, message);
    }
}

From source file:com.google.dart.tools.ui.internal.preferences.DartKeyBindingPreferencePage.java

License:Open Source License

private void resetBindings() {
    if (!MessageDialog.openQuestion(getShell(), PreferencesMessages.DartKeyBindingPref_ResetBindings,
            PreferencesMessages.DartKeyBindingPref_ConfirmReset)) {
        return;// w w w .ja v  a 2  s  . c  om
    }
    try {
        DartKeyBindingPersistence persist;
        persist = new DartKeyBindingPersistence(activityManager, bindingService, commandService);
        persist.resetBindings();
    } catch (CoreException ex) {
        DartToolsPlugin.log(ex);
    }
}

From source file:com.google.eclipse.mechanic.plugin.ui.BaseOutputDialog.java

License:Open Source License

protected IPath getValidOutputLocation() {
    IPath destinationLocation = new Path(getLocation());

    if (!Strings.isNullOrEmpty(extension)) {

        String fileExtension = destinationLocation.getFileExtension();
        if (!extension.equals(fileExtension)) {
            String message = String.format("The file \"%s\" does not have a .%s extension. Add it?",
                    destinationLocation, extension);
            if (MessageDialog.openQuestion(this.getShell(), "Add ." + extension + " to filename?", message)) {
                destinationLocation = destinationLocation.addFileExtension(extension);
                willVerifyOverwrite = true;
            }//from w  ww  .  j  a  va  2  s.  co  m
        }
    }
    // If the user picked a file via the dialog and that file exists, then they've already been 
    // asked if the file should be overwritten, and we shouldn't ask again. If not, then we need 
    // to check if the file exists and, if so, ask them now.
    if (willVerifyOverwrite) {
        if (destinationLocation.toFile().exists()) {
            String message = String.format("The file \"%s\" will be overwritten. Is this OK?",
                    destinationLocation);
            if (!MessageDialog.openQuestion(this.getShell(), "Overwrite?", message)) {
                return null;
            }
        }
    }
    return destinationLocation;
}

From source file:com.google.gdt.eclipse.appengine.rpc.wizards.CreateRPCServiceLayerWizard.java

License:Open Source License

@Override
public boolean performFinish() {

    serviceCreator = RpcServiceLayerCreator.createNewRpcServiceLayerCreator();
    serviceCreator.setEntities(configureRPCPage.getEntityTypes());
    serviceCreator.setGaeProjectSrc(configureRPCPage.getContainerRoot());
    serviceCreator.setServiceName(configureRPCPage.getServiceName());

    if (serviceCreator.serviceExists()) {
        boolean answer = MessageDialog.openQuestion(configureRPCPage.getShell(), "RPC Service exists",
                configureRPCPage.getServiceName()
                        + " already exists. Would you like to overwrite the existing service?");
        if (!answer) {
            return false;
        }/*w w w .  jav  a2  s.  co  m*/
    }

    UpdateQueryBuilder.incrementRPCLayerCount(project, false);

    boolean result = super.performFinish();
    if (result) {
        try {
            JavaUI.openInEditor(serviceCreator.getElement());
        } catch (PartInitException e) {
            AppEngineRPCPlugin.log(e);
        } catch (JavaModelException e) {
            AppEngineRPCPlugin.log(e);
        }
    }
    return result;
}

From source file:com.google.gdt.eclipse.core.actions.AbstractOpenWizardAction.java

License:Open Source License

/**
 * Opens the new project dialog if the workspace is empty. This method is
 * called on {@link #run()}.//  w  w w .  java2s .  c  o m
 * 
 * @param shell the shell to use
 * @return returns <code>true</code> when a project has been created, or
 *         <code>false</code> when the new project has been canceled.
 */
protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    if (workspaceRoot.getProjects().length == 0) {
        String title = NewWizardMessages.AbstractOpenWizardAction_noproject_title;
        String message = NewWizardMessages.AbstractOpenWizardAction_noproject_message;
        if (MessageDialog.openQuestion(shell, title, message)) {
            new NewProjectAction().run();
            return workspaceRoot.getProjects().length != 0;
        }
        return false;
    }
    return true;
}

From source file:com.google.gdt.eclipse.gph.install.P2InstallManagerImpl.java

License:Open Source License

/**
 * Verifies that we found what we were looking for: it's possible that we have
 * connector descriptors that are no longer available on their respective
 * sites. In that case we must inform the user. Unfortunately this is the
 * earliest point at which we can know.//from   w w w  .  j  ava  2 s.  c o  m
 */
private void checkForUnavailable(final List<IInstallableUnit> installableUnits) throws CoreException {
    // at least one selected connector could not be found in a repository
    Set<String> foundIds = new HashSet<String>();
    for (IInstallableUnit unit : installableUnits) {
        foundIds.add(unit.getId());
    }

    String message = ""; //$NON-NLS-1$
    String detailedMessage = ""; //$NON-NLS-1$
    for (P2InstallationUnit descriptor : installUnits) {
        StringBuilder unavailableIds = null;
        for (String id : getFeatureGroupIds(descriptor)) {
            if (!foundIds.contains(id)) {
                if (unavailableIds == null) {
                    unavailableIds = new StringBuilder();
                } else {
                    unavailableIds.append(",");
                }
                unavailableIds.append(id);
            }
        }
        if (unavailableIds != null) {
            if (message.length() > 0) {
                message += ",";
            }
            message += descriptor.getInstallationUnitName();

            if (detailedMessage.length() > 0) {
                detailedMessage += ",";
            }
            detailedMessage += NLS.bind("{0} (id={1}, site={2})",
                    new Object[] { descriptor.getInstallationUnitName(), unavailableIds.toString(),
                            descriptor.getUpdateSite() });
        }
    }

    if (message.length() > 0) {
        // instead of aborting here we ask the user if they wish to proceed
        // anyways
        final boolean[] okayToProceed = new boolean[1];
        final String finalMessage = message;
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                okayToProceed[0] = MessageDialog.openQuestion(Display.getDefault().getActiveShell(),
                        "Proceed With Installation?",
                        NLS.bind(
                                "The following features are not available: {0}\nProceed with the installation anyway?",
                                new Object[] { finalMessage }));
            }
        });
        if (!okayToProceed[0]) {
            throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID,
                    NLS.bind("The following features are not available: {0}", detailedMessage), null));
        }
    }
}

From source file:com.google.gdt.eclipse.login.GoogleLogin.java

License:Open Source License

private boolean logOut(boolean showPrompt, boolean doRevoke) {

    if (!isLoggedIn) {
        return true;
    }/*from   ww w.j  a  va 2s . c  o  m*/

    boolean logOut = true;
    if (showPrompt) {
        logOut = MessageDialog.openQuestion(Display.getDefault().getActiveShell(), "Sign out?",
                "Are you sure you want to sign out?");
    }

    if (logOut) {
        email = "";
        isLoggedIn = false;

        GoogleLoginPrefs.clearStoredCredentials();

        notifyLoginStatusChange(false);
        return true;
    }
    return false;
}

From source file:com.google.gdt.eclipse.suite.launch.WebAppLaunchDelegate.java

License:Open Source License

/**
 * Check to see if the user wants to launch on a specific port and check if that port is available for use. If it is
 * not, ask the user if they want to cancel the launch or continue anyway
 *
 * Visible for testing//from  www . j  a v  a 2 s.co m
 *
 * @param configuration
 *          A Launch Configuration
 * @return true if launch should continue, false if user terminated
 * @throws CoreException
 */
boolean promptUserToContinueIfPortNotAvailable(ILaunchConfiguration configuration) throws CoreException {

    // ignore the auto select case
    if (WebAppLaunchConfiguration.getAutoPortSelection(configuration)) {
        return true;
    }

    // check to see if the port is available for the web app to launch
    // allows user to trigger launch cancellation
    final AtomicBoolean continueLaunch = new AtomicBoolean(true);
    final String port = WebAppLaunchConfiguration.getServerPort(configuration);
    if (!NetworkUtilities.isPortAvailable(port)) {
        Display.getDefault().syncExec(new Runnable() {
            @Override
            public void run() {
                continueLaunch.set(MessageDialog.openQuestion(null, "Port in Use",
                        "The port " + port + " appears to be in use (perhaps by another launch), "
                                + "do you still want to continue with this launch?"));
            }
        });
    }
    return continueLaunch.get();
}

From source file:com.hangum.tadpole.monitoring.core.editors.schedule.ScheduleEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    Composite compositeHead = new Composite(parent, SWT.NONE);
    compositeHead.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeHead.setLayout(new GridLayout(1, false));

    Label lblInfo = new Label(compositeHead, SWT.NONE);
    lblInfo.setText(Messages.ScheduleEditor_1);

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    sashForm.setOrientation(SWT.HORIZONTAL);

    Group compositeList = new Group(sashForm, SWT.NONE);
    compositeList.setLayout(new GridLayout(1, false));
    compositeList.setText("Schedule List");

    ToolBar toolBar = new ToolBar(compositeList, SWT.FLAT | SWT.RIGHT);

    ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
    tltmRefresh.addSelectionListener(new SelectionAdapter() {
        @Override/*from   w  ww  .j ava  2s  . com*/
        public void widgetSelected(SelectionEvent e) {
            refreshSchedule();
        }
    });
    tltmRefresh.setText(Messages.ScheduleEditor_2);

    tltmModify = new ToolItem(toolBar, SWT.NONE);
    tltmModify.setEnabled(false);
    tltmModify.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection();
            if (!iss.isEmpty()) {
                try {
                    ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();
                    UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq());
                    AddScheduleDialog dialog = new AddScheduleDialog(null, userDB, dao);
                    dialog.open();

                } catch (Exception e1) {
                    logger.error("modify schedule", e1);
                }
            }
        }
    });
    tltmModify.setText(Messages.ScheduleEditor_tltmModify_text);

    tltmDelete = new ToolItem(toolBar, SWT.NONE);
    tltmDelete.setEnabled(false);
    tltmDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewerList.getSelection();
            if (!iss.isEmpty()) {

                ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();

                if (!MessageDialog.openQuestion(null, Messages.ScheduleEditor_3, Messages.ScheduleEditor_4))
                    return;
                try {
                    UserDBDAO userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(dao.getDb_seq());
                    ScheduleManager.getInstance().deleteJob(userDB, dao);

                    TadpoleSystem_Schedule.deleteSchedule(dao.getSeq());

                    refreshSchedule();
                } catch (Exception e1) {
                    logger.error("delete schedule", e1); //$NON-NLS-1$
                }
            }
        }
    });
    tltmDelete.setText(Messages.ScheduleEditor_6);

    tableViewerList = new TableViewer(compositeList, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewerList.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection iss = (IStructuredSelection) event.getSelection();
            if (!iss.isEmpty()) {
                tltmDelete.setEnabled(true);
                tltmModify.setEnabled(true);

                ScheduleMainDAO dao = (ScheduleMainDAO) iss.getFirstElement();
                try {
                    List<ScheduleResultDAO> listResult = TadpoleSystem_Schedule.getScheduleResult(dao.getSeq());
                    tvResult.setInput(listResult);
                } catch (Exception e) {
                    logger.error("get schedule result", e); //$NON-NLS-1$
                }
            }
        }
    });
    Table tableList = tableViewerList.getTable();
    tableList.setLinesVisible(true);
    tableList.setHeaderVisible(true);
    tableList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnName = tableViewerColumn.getColumn();
    tblclmnName.setWidth(100);
    tblclmnName.setText(Messages.ScheduleEditor_8);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnDescription = tableViewerColumn_2.getColumn();
    tblclmnDescription.setWidth(100);
    tblclmnDescription.setText(Messages.ScheduleEditor_9);

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerList, SWT.NONE);
    TableColumn tblclmnCreateDate = tableViewerColumn_1.getColumn();
    tblclmnCreateDate.setWidth(200);
    tblclmnCreateDate.setText(Messages.ScheduleEditor_10);

    Group compositeResult = new Group(sashForm, SWT.NONE);
    compositeResult.setLayout(new GridLayout(1, false));
    compositeResult.setText("Schedule Result");

    tvResult = new TableViewer(compositeResult, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = tvResult.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnResult = tableViewerColumn_3.getColumn();
    tblclmnResult.setWidth(52);
    tblclmnResult.setText(Messages.ScheduleEditor_11);

    TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnMessage = tableViewerColumn_4.getColumn();
    tblclmnMessage.setWidth(240);
    tblclmnMessage.setText(Messages.ScheduleEditor_12);

    TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tvResult, SWT.NONE);
    TableColumn tblclmnDate = tableViewerColumn_5.getColumn();
    tblclmnDate.setWidth(140);
    tblclmnDate.setText(Messages.ScheduleEditor_13);

    tableViewerList.setContentProvider(ArrayContentProvider.getInstance());
    tableViewerList.setLabelProvider(new ScheduleLabelProvider());

    tvResult.setContentProvider(ArrayContentProvider.getInstance());
    tvResult.setLabelProvider(new ResultLabelProvider());

    initUI();

    sashForm.setWeights(new int[] { 4, 6 });

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

}

From source file:com.hangum.tadpole.notes.core.views.list.NoteListViewPart.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    setPartName(Messages.NoteListViewPart_0);

    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 1;/*from   w  ww.j a va 2  s .c  om*/
    gl_parent.horizontalSpacing = 1;
    gl_parent.marginHeight = 1;
    gl_parent.marginWidth = 1;
    parent.setLayout(gl_parent);

    Composite compositeToolbar = new Composite(parent, SWT.NONE);
    compositeToolbar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_compositeToolbar = new GridLayout(1, false);
    gl_compositeToolbar.horizontalSpacing = 1;
    gl_compositeToolbar.marginHeight = 1;
    gl_compositeToolbar.marginWidth = 1;
    compositeToolbar.setLayout(gl_compositeToolbar);

    ToolBar toolBar = new ToolBar(compositeToolbar, SWT.FLAT | SWT.RIGHT);
    toolBar.setBounds(0, 0, 88, 20);

    ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
    tltmRefresh.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            initData();
        }
    });
    tltmRefresh.setToolTipText(Messages.NoteListViewPart_1);
    tltmRefresh.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/refresh.png")); //$NON-NLS-1$

    ToolItem tltmCreate = new ToolItem(toolBar, SWT.NONE);
    tltmCreate.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            NewNoteDialog dialog = new NewNoteDialog(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
            if (dialog.OK == dialog.open()) {
                initData();
            }
        }
    });
    tltmCreate.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/notes_new.png")); //$NON-NLS-1$
    tltmCreate.setToolTipText(Messages.NoteListViewPart_2);

    final ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE);
    tltmDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection();
            if (!iss.isEmpty()) {
                try {
                    if (MessageDialog.openQuestion(null, Messages.NoteListViewPart_3,
                            Messages.NoteListViewPart_4)) {
                        NotesDAO noteDao = (NotesDAO) iss.getFirstElement();
                        TadpoleSystem_Notes.deleteNote(noteDao.getSeq());

                        initData();
                    }
                } catch (Exception ee) {
                    logger.error("delete note", ee); //$NON-NLS-1$
                }
            }

        }
    });
    tltmDelete
            .setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/notes_delete.png")); //$NON-NLS-1$
    tltmDelete.setToolTipText(Messages.NoteListViewPart_6);
    tltmDelete.setEnabled(false);

    Composite compositeBody = new Composite(parent, SWT.NONE);
    GridLayout gl_compositeBody = new GridLayout(5, false);
    gl_compositeBody.marginHeight = 1;
    gl_compositeBody.verticalSpacing = 1;
    gl_compositeBody.horizontalSpacing = 1;
    gl_compositeBody.marginWidth = 1;
    compositeBody.setLayout(gl_compositeBody);
    compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Label lblFilter = new Label(compositeBody, SWT.NONE);
    lblFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblFilter.setText(Messages.NoteListViewPart_7);

    comboTypes = new Combo(compositeBody, SWT.READ_ONLY);
    comboTypes.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            initData();
        }
    });
    GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_combo.widthHint = 80;
    gd_combo.minimumWidth = 80;
    comboTypes.setLayoutData(gd_combo);

    comboTypes.add(Messages.NoteListViewPart_8);
    comboTypes.setData(Messages.NoteListViewPart_8, "Send"); //$NON-NLS-1$

    comboTypes.add(Messages.NoteListViewPart_9);
    comboTypes.setData(Messages.NoteListViewPart_9, "Receive"); //$NON-NLS-1$

    comboTypes.select(1);

    comboRead = new Combo(compositeBody, SWT.READ_ONLY);
    comboRead.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            initData();
        }
    });
    comboRead.add(Messages.NoteListViewPart_10);
    comboRead.setData(Messages.NoteListViewPart_10, "Read"); //$NON-NLS-1$

    comboRead.add(Messages.NoteListViewPart_11);
    comboRead.setData(Messages.NoteListViewPart_11, "Not yet Read"); //$NON-NLS-1$

    comboRead.select(0);

    new Label(compositeBody, SWT.NONE);

    textFilter = new Text(compositeBody, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    textFilter.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
                initData();
            }
        }
    });
    textFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Composite compositeDate = new Composite(compositeBody, SWT.NONE);
    compositeDate.setLayout(new GridLayout(5, false));
    compositeDate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1));

    Label lblStart = new Label(compositeDate, SWT.NONE);
    lblStart.setText(Messages.NoteListViewPart_lblStart_text_1);

    dateTimeStart = new DateTime(compositeDate, SWT.BORDER);

    // ?? ? .
    Calendar cal = Calendar.getInstance();
    cal.setTimeInMillis(System.currentTimeMillis() - (7 * 24 * 60 * 60 * 1000));
    dateTimeStart.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));

    Label label = new Label(compositeDate, SWT.NONE);
    label.setText(Messages.NoteListViewPart_label_text);

    dateTimeEnd = new DateTime(compositeDate, SWT.BORDER);

    Button buttonSearch = new Button(compositeDate, SWT.NONE);
    buttonSearch.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            initData();
        }
    });
    buttonSearch.setText(Messages.NoteListViewPart_button_text);

    tableViewer = new TableViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            tltmDelete.setEnabled(true);
        }
    });
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection iss = (IStructuredSelection) tableViewer.getSelection();
            if (!iss.isEmpty()) {

                String selComboType = (String) comboTypes.getData(comboTypes.getText());
                NOTE_TYPES noteType = selComboType.equals("Send") ? NOTE_TYPES.SEND : NOTE_TYPES.RECEIVE; //$NON-NLS-1$
                ViewDialog dialog = new ViewDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        (NotesDAO) iss.getFirstElement(), noteType);
                if (Dialog.OK == dialog.open()) {
                    initData();
                }
            }
        }
    });
    Table table = tableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));

    createColumns();

    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setLabelProvider(new NoteListLabelProvider());

    initData();

    // google analytic
    AnalyticCaller.track(this.getClass().getName());
}