Example usage for org.eclipse.jface.dialogs Dialog DIALOG_PERSISTLOCATION

List of usage examples for org.eclipse.jface.dialogs Dialog DIALOG_PERSISTLOCATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog DIALOG_PERSISTLOCATION.

Prototype

int DIALOG_PERSISTLOCATION

To view the source code for org.eclipse.jface.dialogs Dialog DIALOG_PERSISTLOCATION.

Click Source Link

Document

Persist the last location of the dialog.

Usage

From source file:de.loskutov.anyedit.actions.compare.CompareWithEditorAction.java

License:Open Source License

public static ListDialog createSelectionDialog(AbstractEditor myEditor, ContentWrapper selectedContent,
        String message) {/*  w w  w.  ja  va  2s  .  c  o  m*/
    EditorsContentProvider contentProvider = new EditorsContentProvider(myEditor, selectedContent);
    ILabelProvider labelProvider = new EditorsLabelProvider(contentProvider);

    class MyListDialog extends ListDialog {
        public MyListDialog(Shell parent) {
            super(parent);
            setShellStyle(getShellStyle() | SWT.RESIZE);
        }
    }
    ListDialog dialog = new MyListDialog(AnyEditToolsPlugin.getShell());
    dialog.setContentProvider(contentProvider);
    dialog.setLabelProvider(labelProvider);
    dialog.setTitle("Select editor");
    dialog.setMessage(message);
    dialog.setInput(new byte[0]);
    dialog.setDialogBoundsSettings(AnyEditToolsPlugin.getDefault().getDialogSettings(),
            Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTSIZE);
    return dialog;
}

From source file:net.tourbook.ui.views.rawData.ActionSaveTourInDatabase.java

License:Open Source License

private TourPerson selectPersonInDialog() {

    if (_people == null) {
        _people = PersonManager.getTourPeople();
    }//from w  w  w . j  av  a2  s . c o m

    final ResizeableListDialog dialog = new ResizeableListDialog(_rawDataView.getSite().getShell());

    dialog.setContentProvider(new PeopleContentProvider());
    dialog.setLabelProvider(new PeopleLabelProvider());

    dialog.setTitle(Messages.import_data_dlg_save_tour_title);
    dialog.setMessage(Messages.import_data_dlg_save_tour_msg);
    dialog.setDialogBoundsSettings(_state, Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTSIZE);

    // select last person
    try {
        final long personId = _state.getLong(STATE_SELECTED_PERSON);
        for (final TourPerson person : _people) {
            if (person.getPersonId() == personId) {
                dialog.setInitialSelections(new TourPerson[] { person });
                break;
            }
        }
    } catch (final NumberFormatException e) {
    }

    dialog.setInput(this);
    dialog.create();

    // disable ok button when no people are available
    if (_people.size() == 0) {
        dialog.getOkButton().setEnabled(false);
    }

    if (dialog.open() != Window.OK) {
        return null;
    }

    final Object[] people = dialog.getResult();
    if (people != null && people.length > 0) {
        final TourPerson selectedPerson = (TourPerson) people[0];

        _state.put(STATE_SELECTED_PERSON, selectedPerson.getPersonId());

        return selectedPerson;
    } else {
        return null;
    }
}

From source file:org.eclipse.mylyn.internal.tasks.ui.actions.OpenRepositoryTaskAction.java

License:Open Source License

public void run(IAction action) {
    RemoteTaskSelectionDialog dlg = new RemoteTaskSelectionDialog(WorkbenchUtil.getShell());
    dlg.setTitle(Messages.OpenRepositoryTask_Open_Repository_Task);

    IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
    IDialogSettings dlgSettings = settings.getSection(OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS);
    if (dlgSettings == null) {
        dlgSettings = settings.addNewSection(OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS);
    }//from  w  ww  .  j  a  v  a  2 s  .c  o m
    dlg.setDialogBoundsSettings(dlgSettings, Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTSIZE);

    if (dlg.open() == Window.OK) {
        if (dlg.getSelectedTask() != null) {
            openExistingTask(dlg);
        } else {
            openRemoteTask(dlg);
        }
    }
}

From source file:org.kalypso.ogc.gml.util.AddFeatureHandlerUtil.java

License:Open Source License

public static IFeatureType chooseFeatureType(final Shell shell, final String dialogTitle,
        final IRelationType relationType, final GMLWorkspace workspace) {
    final IGMLSchema gmlSchema = workspace.getGMLSchema();

    final IFeatureType targetFeatureType = relationType.getTargetFeatureType();
    final IFeatureType[] substituts = GMLSchemaUtilities.getSubstituts(targetFeatureType, gmlSchema, false,
            true);//  ww w.  j  a  va2 s  .  c o  m

    if (substituts.length == 0) {
        // May only happen if the type is abstract
        final String message = String.format(Messages.getString("AddFeatureHandlerUtil.0"), //$NON-NLS-1$
                getNewLabel(relationType));
        MessageDialog.openWarning(shell, dialogTitle, message);
        return null;
    }

    if (substituts.length == 1)
        return substituts[0];

    /* Let user choose */
    final String message = Messages.getString("AddFeatureHandlerUtil.1"); //$NON-NLS-1$

    final ILabelProvider labelProvider = new FeatureTypeLabelProvider(IAnnotation.ANNO_NAME);
    // final TreeSingleSelectionDialog dialog = new TreeSingleSelectionDialog( shell, substituts, new
    // ArrayTreeContentProvider(), labelProvider, message );

    final ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);

    dialog.setMessage(message);
    dialog.setEmptySelectionMessage(""); //$NON-NLS-1$
    dialog.setTitle(dialogTitle);

    dialog.setElements(substituts);
    dialog.setDialogBoundsSettings(
            DialogSettingsUtils.getDialogSettings(KalypsoGisPlugin.getDefault(),
                    AddFeatureHandlerUtil.class.getName()),
            Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTLOCATION);
    dialog.setAllowDuplicates(false);
    dialog.setInitialSelections(new Object[] { substituts[0] });
    dialog.setMultipleSelection(false);

    if (dialog.open() == Window.CANCEL)
        return null;

    return (IFeatureType) dialog.getResult()[0];
}

From source file:org.rssowl.ui.internal.dialogs.CustomizeToolbarDialog.java

License:Open Source License

@Override
protected int getDialogBoundsStrategy() {
    return Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTSIZE;
}