Example usage for org.eclipse.jface.viewers StructuredSelection EMPTY

List of usage examples for org.eclipse.jface.viewers StructuredSelection EMPTY

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StructuredSelection EMPTY.

Prototype

StructuredSelection EMPTY

To view the source code for org.eclipse.jface.viewers StructuredSelection EMPTY.

Click Source Link

Document

The canonical empty selection.

Usage

From source file:org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor.java

License:Apache License

/**
 * Sets the entry editor widget input. A clone of the real entry
 * with a read-only connection is used for that.
 * @param eei //from  ww w .j  ava2  s  . c  o m
 */
private void setEntryEditorWidgetInput(EntryEditorInput eei) {
    if (mainWidget != null) {
        universalListener.setInput(eei.getSharedWorkingCopy(this));

        /*
         * Explicitly deselect previously selected attributes and values.
         * This avoids disabled actions if the new input is equal but not
         * identical to the previous input. This happens for example if
         * an ISearchResult or IBookmark object is open and afterwards 
         * the IEntry object is opened.
         */
        mainWidget.getViewer().setSelection(StructuredSelection.EMPTY);
    }
}

From source file:org.apache.directory.studio.ldapbrowser.ui.editors.schemabrowser.SchemaPage.java

License:Apache License

/**
 * Refreshes this schema page.//from   ww  w.  j  a  v  a  2 s . co m
 */
public void refresh() {
    Schema schema = null;
    if (showDefaultSchemaAction.isChecked()) {
        schema = Schema.DEFAULT_SCHEMA;
    } else if (getConnection() != null) {
        schema = getConnection().getSchema();
    }

    if (viewer.getInput() != schema) {
        viewer.setInput(schema);
        viewer.setSelection(StructuredSelection.EMPTY);
    }

    form.setText(getTitle());
    viewer.refresh();
}

From source file:org.apache.directory.studio.ldapservers.actions.NewServerAction.java

License:Apache License

/**
 * {@inheritDoc}// w w  w .j  a  v  a2 s .  co m
 */
public void run() {
    // Instantiates and initializes the wizard
    NewServerWizard wizard = new NewServerWizard();
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.CommitChangesAction.java

License:Apache License

/**
 * {@inheritDoc}/*w  w w  .  j a v  a 2s . c o  m*/
 */
public void run() {
    // Instantiates and initializes the wizard
    CommitChangesWizard wizard = new CommitChangesWizard();
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ExportProjectsAction.java

License:Apache License

/**
 * {@inheritDoc}/* w  ww  . j a  v a2  s.  c o  m*/
 */
public void run() {
    List<Project> selectedProjects = new ArrayList<Project>();
    // Getting the selection
    StructuredSelection selection = (StructuredSelection) viewer.getSelection();
    if ((!selection.isEmpty()) && (selection.size() > 0)) {
        for (Iterator<?> i = selection.iterator(); i.hasNext();) {
            selectedProjects.add(((ProjectWrapper) i.next()).getProject());
        }
    }

    // Instantiates and initializes the wizard
    ExportProjectsWizard wizard = new ExportProjectsWizard();
    wizard.setSelectedProjects(selectedProjects.toArray(new Project[0]));
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ExportSchemasAsOpenLdapAction.java

License:Apache License

/**
 * {@inheritDoc}//from  w  w w  .  ja v  a  2  s .  c o  m
 */
public void run() {
    List<Schema> selectedSchemas = new ArrayList<Schema>();
    // Getting the selection
    StructuredSelection selection = (StructuredSelection) viewer.getSelection();
    if ((!selection.isEmpty()) && (selection.size() > 0)) {
        for (Iterator<?> i = selection.iterator(); i.hasNext();) {
            Object o = i.next();
            if (o instanceof SchemaWrapper) {
                selectedSchemas.add(((SchemaWrapper) o).getSchema());
            }
        }
    }

    // Instantiates and initializes the wizard
    ExportSchemasAsOpenLdapWizard wizard = new ExportSchemasAsOpenLdapWizard();
    wizard.setSelectedSchemas(selectedSchemas.toArray(new Schema[0]));
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ExportSchemasAsXmlAction.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w w. j  av a2s .com*/
 */
public void run() {
    List<Schema> selectedSchemas = new ArrayList<Schema>();
    // Getting the selection
    StructuredSelection selection = (StructuredSelection) viewer.getSelection();
    if ((!selection.isEmpty()) && (selection.size() > 0)) {
        for (Iterator<?> i = selection.iterator(); i.hasNext();) {
            Object o = i.next();
            if (o instanceof SchemaWrapper) {
                selectedSchemas.add(((SchemaWrapper) o).getSchema());
            }
        }
    }

    // Instantiates and initializes the wizard
    ExportSchemasAsXmlWizard wizard = new ExportSchemasAsXmlWizard();
    wizard.setSelectedSchemas(selectedSchemas.toArray(new Schema[0]));
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ExportSchemasForADSAction.java

License:Apache License

/**
 * {@inheritDoc}/*from w  ww.  j a  va 2 s  .  com*/
 */
public void run() {
    List<Schema> selectedSchemas = new ArrayList<Schema>();
    // Getting the selection
    StructuredSelection selection = (StructuredSelection) viewer.getSelection();
    if ((!selection.isEmpty()) && (selection.size() > 0)) {
        for (Iterator<?> i = selection.iterator(); i.hasNext();) {
            Object o = i.next();
            if (o instanceof SchemaWrapper) {
                selectedSchemas.add(((SchemaWrapper) o).getSchema());
            }
        }
    }

    // Instantiates and initializes the wizard
    ExportSchemasForADSWizard wizard = new ExportSchemasForADSWizard();
    wizard.setSelectedSchemas(selectedSchemas.toArray(new Schema[0]));
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ImportCoreSchemasAction.java

License:Apache License

/**
 * {@inheritDoc}//from   w w w .j  a va2s .  c om
 */
public void run() {
    // Instantiates and initializes the wizard
    ImportCoreSchemasWizard wizard = new ImportCoreSchemasWizard();
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}

From source file:org.apache.directory.studio.schemaeditor.controller.actions.ImportProjectsAction.java

License:Apache License

/**
 * {@inheritDoc}/*from www  .j  a  v a2 s . c  o  m*/
 */
public void run() {
    // Instantiates and initializes the wizard
    ImportProjectsWizard wizard = new ImportProjectsWizard();
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    // Instantiates the wizard container with the wizard and opens it
    WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard);
    dialog.create();
    dialog.open();
}