本文整理汇总了Java中org.eclipse.e4.ui.workbench.modeling.ESelectionService类的典型用法代码示例。如果您正苦于以下问题:Java ESelectionService类的具体用法?Java ESelectionService怎么用?Java ESelectionService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ESelectionService类属于org.eclipse.e4.ui.workbench.modeling包,在下文中一共展示了ESelectionService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canExecute
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@CanExecute
public boolean canExecute(ESelectionService selectionService,
@Optional @Named(PARAM_RESOURCE_TYPE) String resourceType) {
Object s = selectionService.getSelection();
if (resourceType == null) {
return s != null && (s instanceof ECorpus || s instanceof EPipeline || s instanceof ETerminology);
} else {
if (resourceType.equals(EPipeline.class.getName()))
return s != null && s instanceof EPipeline;
else if (resourceType.equals(ECorpus.class.getName()))
return s != null && s instanceof ECorpus;
else if (resourceType.equals(ETerminology.class.getName()))
return s != null && s instanceof ETerminology;
}
return false;
}
示例2: createControls
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@PostConstruct
public void createControls(final Composite parent, final ESelectionService selectionService) {
this.order = (Order) selectionService.getSelection();
this.orderDetailPanel = new OrderDetailView(parent, order);
this.orderDetailPanel.addOrderNumberKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (orderNumberHasChanged()) {
dirtyable.setDirty(true);
} else {
dirtyable.setDirty(false);
}
}
});
}
示例3: canExecute
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@CanExecute
public boolean canExecute(ESelectionService selectionService){
Object selection = selectionService.getSelection();
if(selection instanceof Object[]){
for(Object o : (Object[])selection){
if(!canDelete(o)){
return false;
}
}
}
else if(!canDelete(selection)){
return false;
}
return true;
}
示例4: execute
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
ResourceService resourceService,
ESelectionService selectionService, EPartService partService) {
Object s = selectionService.getSelection();
boolean ok = MessageDialog.openConfirm(shell, "Confirmation", String.format(
"Are you sure that you want to remove the %s \"%s\" ?", getResourceTypeName(s), getResourceName(s)));
if (ok) {
if (s instanceof EPipeline) {
resourceService.remove((EPipeline) s);
} else if (s instanceof ECorpus) {
resourceService.removeCorpus((ECorpus) s);
} else if (s instanceof ETerminology) {
resourceService.removeTerminology((ETerminology) s);
}
for (MPart p : partService.getParts()) {
if (p != null && p.getContext() != null) {
Object inputObject = p.getContext().get(TermSuiteUI.INPUT_OBJECT);
if (inputObject != null && inputObject == s) {
partService.hidePart(p, true);
}
}
}
}
}
示例5: createControls
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@PostConstruct
public void createControls(final Composite parent, final ArticleService articleService,
final ESelectionService selectionService, @Optional PositionWithOrderAndArticleInfoDTO positionViewDTO) {
if (positionViewDTO == null) {
positionViewDTO = (PositionWithOrderAndArticleInfoDTO) selectionService.getSelection();
}
this.positionViewDTO = positionViewDTO;
this.positionDetailPanel = new PositionDetailView(parent, articleService);
this.positionDetailPanel.setOrder(positionViewDTO.getOrder());
this.positionDetailPanel.setPosition(positionViewDTO.getPosition());
this.positionDetailPanel.setPositionNumber(positionViewDTO.getPositionNumber());
this.positionDetailPanel.addChangeListeners(new ArticleModifyListener(), new AmountKeyListner());
}
示例6: setSelectionService
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@Inject @Optional
public void setSelectionService(ESelectionService service) {
System.out.println("Selection service set");
if (service != null){
this.service = service;
} else {
System.out.println("Service is null");
}
}
示例7: compute
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@Override
public Object compute(IEclipseContext context, String contextKey) {
ESelectionService es = context.get(ESelectionService.class);
if( es == null ) {
return null;
}
return new Publisher(es);
}
示例8: createControls
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@PostConstruct
public void createControls(final IEclipseContext context,
final ESelectionService selectionService,
final EMenuService menuService,
final EPartService partService,
final Composite parent, MPart part) {
parent.setLayout(new GridLayout(7, false));
viewerConfig = createDefaultViewerConfig();
context.set(ETerminoViewerConfig.class, viewerConfig);
this.eventBroker.subscribe(
TermSuiteEvents.SEARCH_TEXT_MODIFIED,
event -> viewerConfig.setSearchString((String)event.getProperty(IEventBroker.DATA))
);
viewerConfig.eAdapters().add(new AdapterImpl(){
@Override
public void notifyChanged(Notification msg) {
super.notifyChanged(msg);
if(msg.getFeatureID(ETerminoViewerConfig.class) == TermsuiteuiPackage.ETERMINO_VIEWER_CONFIG__SELECTED_PROPERTY_NAMES) {
switch(msg.getEventType()) {
case Notification.REMOVE:
Property<?> removedProperty = PropertyUtil.forName(msg.getOldStringValue());
for(TreeColumn column:viewer.getTree().getColumns()) {
if(column.getData().equals(removedProperty))
column.dispose();
}
break;
case Notification.ADD:
createColumn(PropertyUtil.forName(msg.getNewStringValue()));
}
viewer.getControl().getParent().layout();
}
}
});
// populate headers
createFilterHeader(parent);
// populate viewer
Composite container = new Composite(parent, SWT.None);
GridDataFactory.fillDefaults().span(7, 1).grab(true, true).applyTo(container);
createViewer(container);
viewer.getNbTermsDisplayed().addChangeListener(e -> {
ETerminology eTerminology = context.get(ETerminology.class);
totalDisplayedTerms.setText(getTotalText(
viewer.getNbTermsDisplayed().getValue(),
eTerminologyService.readTerminology(eTerminology).getTerminology().getTerms().size()));
});
viewer.addSelectionChangedListener(e -> {
IStructuredSelection selection = (IStructuredSelection)e.getSelection();
if(!selection.isEmpty()) {
Object el = selection.getFirstElement();
if(el instanceof TermService) {
selectionService.setSelection(el);
termSuiteSelectionService.setActiveTerm((TermService)el);
} if(el instanceof RelationService) {
selectionService.setSelection(((RelationService)el).getTo());
termSuiteSelectionService.setActiveTerm(((RelationService)el).getTo());
}
}
});
}
示例9: Publisher
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
public Publisher(@NonNull ESelectionService es) {
this.es = es;
}
示例10: execute
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; //导入依赖的package包/类
@Execute
public void execute(ESelectionService selectionService){
Object selection = selectionService.getSelection();
IWorkbenchWizard wizard = new ImportResultsWizard();
wizard.init(PlatformUI.getWorkbench(), (selection instanceof IStructuredSelection) ? (IStructuredSelection)selection : null);
WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
}