List of usage examples for org.eclipse.jface.viewers StructuredSelection EMPTY
StructuredSelection EMPTY
To view the source code for org.eclipse.jface.viewers StructuredSelection EMPTY.
Click Source Link
From source file:org.apache.directory.studio.schemaeditor.controller.actions.ImportSchemasFromOpenLdapAction.java
License:Apache License
/** * {@inheritDoc}//from www . j ava 2 s .com */ public void run() { // Instantiates and initializes the wizard ImportSchemasFromOpenLdapWizard wizard = new ImportSchemasFromOpenLdapWizard(); 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.ImportSchemasFromXmlAction.java
License:Apache License
/** * {@inheritDoc}//from w w w . j a v a 2 s. com */ public void run() { // Instantiates and initializes the wizard ImportSchemasFromXmlWizard wizard = new ImportSchemasFromXmlWizard(); 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.MergeSchemasAction.java
License:Apache License
/** * {@inheritDoc}/*from www .jav a2s. c om*/ */ public void run() { // Instantiates and initializes the wizard MergeSchemasWizard wizard = new MergeSchemasWizard(); 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.NewAttributeTypeAction.java
License:Apache License
/** * {@inheritDoc}/* w ww . j a v a2s . c o m*/ */ public void run() { // Getting the selection Schema selectedSchema = null; int presentation = Activator.getDefault().getPreferenceStore() .getInt(PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION); if (presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT) { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); if ((!selection.isEmpty()) && (selection.size() == 1)) { Object firstElement = selection.getFirstElement(); if (firstElement instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) firstElement).getSchema(); } else if (firstElement instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) firstElement).getParent()).getSchema(); } else if (firstElement instanceof AttributeTypeWrapper) { TreeNode parent = ((AttributeTypeWrapper) firstElement).getParent(); if (parent instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) parent).getParent()).getSchema(); } else if (parent instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) parent).getSchema(); } } else if (firstElement instanceof ObjectClassWrapper) { TreeNode parent = ((ObjectClassWrapper) firstElement).getParent(); if (parent instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) parent).getParent()).getSchema(); } else if (parent instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) parent).getSchema(); } } } } // Instantiates and initializes the wizard NewAttributeTypeWizard wizard = new NewAttributeTypeWizard(); wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY); wizard.setSelectedSchema(selectedSchema); // 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.NewObjectClassAction.java
License:Apache License
/** * {@inheritDoc}// w ww. j a v a 2 s. c o m */ public void run() { // Getting the selection Schema selectedSchema = null; int presentation = Activator.getDefault().getPreferenceStore() .getInt(PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION); if (presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT) { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); if ((!selection.isEmpty()) && (selection.size() == 1)) { Object firstElement = selection.getFirstElement(); if (firstElement instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) firstElement).getSchema(); } else if (firstElement instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) firstElement).getParent()).getSchema(); } else if (firstElement instanceof AttributeTypeWrapper) { TreeNode parent = ((AttributeTypeWrapper) firstElement).getParent(); if (parent instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) parent).getParent()).getSchema(); } else if (parent instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) parent).getSchema(); } } else if (firstElement instanceof ObjectClassWrapper) { TreeNode parent = ((ObjectClassWrapper) firstElement).getParent(); if (parent instanceof Folder) { selectedSchema = ((SchemaWrapper) ((Folder) parent).getParent()).getSchema(); } else if (parent instanceof SchemaWrapper) { selectedSchema = ((SchemaWrapper) parent).getSchema(); } } } } // Instantiates and initializes the wizard NewObjectClassWizard wizard = new NewObjectClassWizard(); wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY); wizard.setSelectedSchema(selectedSchema); // 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.NewProjectAction.java
License:Apache License
/** * {@inheritDoc}//from w ww . ja v a2 s . c o m */ public void run() { // Instantiates and initializes the wizard NewProjectWizard wizard = new NewProjectWizard(); 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.NewSchemaAction.java
License:Apache License
/** * {@inheritDoc}//from www . j a v a2s .c o m */ public void run() { // Instantiates and initializes the wizard NewSchemaWizard wizard = new NewSchemaWizard(); 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.felix.sigil.eclipse.cheatsheets.actions.AbstractNewWizardAction.java
License:Apache License
private IStructuredSelection getSelection() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; }//from w ww. j a v a 2 s . c o m } return StructuredSelection.EMPTY; }
From source file:org.apache.felix.sigil.eclipse.ui.util.BackgroundLoadingSelectionDialog.java
License:Apache License
protected void updateSelection() { onUIThread(getShell(), new Runnable() { public void run() { if (selectedName != null) { ArrayList<E> newSelection = new ArrayList<E>(); synchronized (elements) { for (E e : elements) { if (selectedName.equals(descriptor.getName(e))) { newSelection.add(e); break; }//from w w w . j av a 2 s. co m } } selection = newSelection; } else { selection = Collections.emptyList(); } if (viewer != null && !viewer.getControl().isDisposed()) { viewer.setSelection( selection.isEmpty() ? StructuredSelection.EMPTY : new StructuredSelection(selection)); } } }); }
From source file:org.ascape.view.vis.GraphicsView.java
License:Open Source License
public void createImageFigure() { imageFigure = new Figure() { public void paintFigure(Graphics graphics) { synchronized (this) { if (image != null && !image.isDisposed()) { graphics.drawImage(image, 0, 0); }//from www. j ava 2 s .c om } } }; imageFigure.setLayoutManager(new AbstractLayout() { public Dimension getMinimumSize(IFigure container, int hintWidth, int hintHeight) { if (getScape() != null) { return getMinimumSizeWithin(new Dimension(hintWidth, hintHeight)); } return new Dimension(500, 500); } protected Dimension calculatePreferredSize(IFigure container, int hintWidth, int hintHeight) { if (getScape() != null) { return getPreferredSizeWithin(new Dimension(hintWidth, hintHeight)); } else { return new Dimension(500, 500); } } public void layout(IFigure container) { imageFigure.setLocation(new Point(0, 0)); } }); imageFigure.addFigureListener(new FigureListener() { public void figureMoved(IFigure source) { refresh(); } }); imageFigure.addMouseListener(new MouseListener() { public void mouseDoubleClicked(MouseEvent me) { } public void mousePressed(MouseEvent me) { LocatedAgent agentAtPixel = (LocatedAgent) getAgentAtPixel(me.getLocation().x, me.getLocation().y); if (agentAtPixel instanceof LocatedAgent) { if (agentAtPixel instanceof HostCell && (me.getState() & MouseEvent.CONTROL) == 0) { CellOccupant occupant = (CellOccupant) ((HostCell) agentAtPixel).getOccupant(); if (occupant != null) { agentAtPixel = occupant; } } if ((me.getState() & MouseEvent.SHIFT) > 0) { if (!selectedAgents.contains(agentAtPixel)) { selectedAgents.add(agentAtPixel); } else { selectedAgents.remove(agentAtPixel); } } else { selectedAgents = new HashSet<LocatedAgent>(); selectedAgents.add(agentAtPixel); } } else { currentSelection = StructuredSelection.EMPTY; } currentSelection = new StructuredSelection(selectedAgents.toArray()); setSelection(currentSelection); fireSelectionChanged(); ((Display) getImage().getDevice()).syncExec(new Runnable() { public void run() { refresh(); }; }); } public void mouseReleased(MouseEvent me) { } }); }