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:de.dfki.iui.mmds.sdk.editors.model.ProjectEditor.java
License:Creative Commons License
/** * Handles what to do with changed resources on activation. <!-- * begin-user-doc --> <!-- end-user-doc --> * // www. j a v a 2s . c o m * @generated NOT */ protected void handleChangedResources() { if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { if (isDirty()) { changedResources.addAll(editingDomain.getResourceSet().getResources()); } editingDomain.getCommandStack().flush(); updateProblemIndication = false; for (Resource resource : changedResources) { if (resource.isLoaded()) { resource.unload(); try { EmfPersistence.read(resource, null); resource.load(resource.getResourceSet().getLoadOptions()); } catch (IOException exception) { if (!resourceToDiagnosticMap.containsKey(resource)) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } } } } if (AdapterFactoryEditingDomain.isStale(editorSelection)) { setSelection(StructuredSelection.EMPTY); } updateProblemIndication = true; updateProblemIndication(); } }
From source file:de.dfki.iui.mmds.sdk.editors.model.ProjectEditor.java
License:Creative Commons License
/** * This makes sure that one content viewer, either for the current page or * the outline view, if it has focus, is the current one. <!-- * begin-user-doc --> <!-- end-user-doc --> * /* w ww .j av a 2s. c om*/ * @generated */ public void setCurrentViewer(Viewer viewer) { // If it is changing... // if (currentViewer != viewer) { if (selectionChangedListener == null) { // Create the listener on demand. // selectionChangedListener = new ISelectionChangedListener() { // This just notifies those things that are affected by the // section. // @Override public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { setSelection(selectionChangedEvent.getSelection()); } }; } // Stop listening to the old one. // if (currentViewer != null) { currentViewer.removeSelectionChangedListener(selectionChangedListener); } // Start listening to the new one. // if (viewer != null) { viewer.addSelectionChangedListener(selectionChangedListener); } // Remember it. // currentViewer = viewer; // Set the editors selection based on the current viewer's // selection. // setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); } }
From source file:de.gulden.modeling.wave.diagram.navigator.WaveNavigatorLinkHelper.java
License:Open Source License
/** * @generated//from w ww . j av a2 s . co m */ public IStructuredSelection findSelection(IEditorInput anInput) { IDiagramDocument document = WaveDiagramEditorPlugin.getInstance().getDocumentProvider() .getDiagramDocument(anInput); if (document == null) { return StructuredSelection.EMPTY; } Diagram diagram = document.getDiagram(); IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); if (file != null) { WaveNavigatorItem item = new WaveNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
From source file:de.gulden.modeling.wave.diagram.part.WaveDiagramEditor.java
License:Open Source License
/** * @generated/*ww w . j a v a 2 s . c om*/ */ private ISelection getNavigatorSelection() { IDiagramDocument document = getDiagramDocument(); if (document == null) { return StructuredSelection.EMPTY; } Diagram diagram = document.getDiagram(); IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); if (file != null) { WaveNavigatorItem item = new WaveNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
From source file:de.gulden.modeling.wave.diagram.part.WaveNewDiagramFileWizard.java
License:Open Source License
/** * @generated//from w w w .j av a2s . co m */ public WaveNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, TransactionalEditingDomain editingDomain) { assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$ myFileCreationPage = new WizardNewFileCreationPage(Messages.WaveNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY); myFileCreationPage.setTitle(Messages.WaveNewDiagramFileWizard_CreationPageTitle); myFileCreationPage.setDescription( NLS.bind(Messages.WaveNewDiagramFileWizard_CreationPageDescription, ModelEditPart.MODEL_ID)); IPath filePath; String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment()); if (domainModelURI.isPlatformResource()) { filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true)); } else if (domainModelURI.isFile()) { filePath = new Path(domainModelURI.trimSegments(1).toFileString()); } else { // TODO : use some default path throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$ } myFileCreationPage.setContainerFullPath(filePath); myFileCreationPage.setFileName(WaveDiagramEditorUtil.getUniqueFileName(filePath, fileName, "wave_diagram")); //$NON-NLS-1$ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage( Messages.WaveNewDiagramFileWizard_RootSelectionPageName); diagramRootElementSelectionPage.setTitle(Messages.WaveNewDiagramFileWizard_RootSelectionPageTitle); diagramRootElementSelectionPage .setDescription(Messages.WaveNewDiagramFileWizard_RootSelectionPageDescription); diagramRootElementSelectionPage.setModelElement(diagramRoot); myEditingDomain = editingDomain; }
From source file:de.hentschel.visualdbc.dbcmodel.diagram.navigator.DbCNavigatorLinkHelper.java
License:Open Source License
/** * @generated//from w w w. j a v a 2s .c o m */ public IStructuredSelection findSelection(IEditorInput anInput) { IDiagramDocument document = DbCDiagramEditorPlugin.getInstance().getDocumentProvider() .getDiagramDocument(anInput); if (document == null) { return StructuredSelection.EMPTY; } Diagram diagram = document.getDiagram(); if (diagram == null || diagram.eResource() == null) { return StructuredSelection.EMPTY; } IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); if (file != null) { DbCNavigatorItem item = new DbCNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
From source file:de.hentschel.visualdbc.dbcmodel.diagram.part.DbCDiagramEditor.java
License:Open Source License
/** * @generated//www . j a v a 2 s .c o m */ private ISelection getNavigatorSelection() { IDiagramDocument document = getDiagramDocument(); if (document == null) { return StructuredSelection.EMPTY; } Diagram diagram = document.getDiagram(); if (diagram == null || diagram.eResource() == null) { return StructuredSelection.EMPTY; } IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); if (file != null) { DbCNavigatorItem item = new DbCNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
From source file:de.hentschel.visualdbc.dbcmodel.diagram.part.DbCNewDiagramFileWizard.java
License:Open Source License
/** * @generated/*w w w . jav a 2 s .co m*/ */ public DbCNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, TransactionalEditingDomain editingDomain) { assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$ myFileCreationPage = new WizardNewFileCreationPage(Messages.DbCNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY); myFileCreationPage.setTitle(Messages.DbCNewDiagramFileWizard_CreationPageTitle); myFileCreationPage.setDescription( NLS.bind(Messages.DbCNewDiagramFileWizard_CreationPageDescription, DbcModelEditPart.MODEL_ID)); IPath filePath; String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment()); if (domainModelURI.isPlatformResource()) { filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true)); } else if (domainModelURI.isFile()) { filePath = new Path(domainModelURI.trimSegments(1).toFileString()); } else { // TODO : use some default path throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$ } myFileCreationPage.setContainerFullPath(filePath); myFileCreationPage.setFileName(DbCDiagramEditorUtil.getUniqueFileName(filePath, fileName, "dbc_diagram")); //$NON-NLS-1$ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage( Messages.DbCNewDiagramFileWizard_RootSelectionPageName); diagramRootElementSelectionPage.setTitle(Messages.DbCNewDiagramFileWizard_RootSelectionPageTitle); diagramRootElementSelectionPage .setDescription(Messages.DbCNewDiagramFileWizard_RootSelectionPageDescription); diagramRootElementSelectionPage.setModelElement(diagramRoot); myEditingDomain = editingDomain; }
From source file:de.justi.yagw2api.explorer.rcp.wvw.MapDetailsViewPart.java
License:Apache License
private synchronized void selectMatch(final WVWMatch match) { checkNotNull(match, "missing match"); final Optional<WVWMatch> currentMatchSelection = this.getSelectedMatch(); if (!currentMatchSelection.isPresent() || !currentMatchSelection.get().equals(match)) { LOGGER.trace("Select match: {}", match); this.matchSelectionComboViewer.setSelection(new StructuredSelection(match)); this.mapSelectionComboViewer.setInput(match); }//from w w w. j a v a 2 s . c o m final Optional<WVWMap> currentMapSelection = this.getSelectedMap(); if (currentMapSelection.isPresent()) { LOGGER.trace("Clear map selection for {}", match); this.mapSelectionComboViewer.setSelection(StructuredSelection.EMPTY); this.mapObjectivesTableViewer.setInput(null); Activator.getDefault().getWVW().unregisterWVWMapListener(this); } }
From source file:de.loskutov.eclipseskins.ui.AbstractPartListControl.java
License:Open Source License
/** * Selects the first element in the table which matches the current filter * pattern./*from www .ja v a 2 s . c o m*/ */ protected void selectFirstMatch() { Table table = fTableViewer.getTable(); Object element = namePatternFilter.findElement(table.getItems(), (ILabelProvider) fTableViewer.getLabelProvider()); if (element != null) { fTableViewer.setSelection(new StructuredSelection(element), true); } else { fTableViewer.setSelection(StructuredSelection.EMPTY); } }