本文整理汇总了Java中org.eclipse.e4.ui.services.IServiceConstants.ACTIVE_SHELL属性的典型用法代码示例。如果您正苦于以下问题:Java IServiceConstants.ACTIVE_SHELL属性的具体用法?Java IServiceConstants.ACTIVE_SHELL怎么用?Java IServiceConstants.ACTIVE_SHELL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.e4.ui.services.IServiceConstants
的用法示例。
在下文中一共展示了IServiceConstants.ACTIVE_SHELL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
@Persist
public void save(MDirtyable dirty,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
String absolutePath = this.fileInput.getFile().getAbsolutePath();
logger.debug("Saving " + absolutePath);
try {
fileInput.save(this.text.getText());
// save was successful
dirty.setDirty(false);
} catch (IOException e) {
logger.error(e);
MessageDialog.openError(shell, "Save error", e.getMessage());
}
}
示例2: execute
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Optional TerminologyService terminologyService,
@Optional ETerminology terminology,
@Optional IndexedCorpus indexedCorpus
) throws IOException {
FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
fileDialog.setText("Exporting terminology "+ TerminologyPart.toPartLabel(terminology) +" to " + formatName);
String path = fileDialog.open();
if(path != null) {
if(withOptionDialog) {
Dialog dialog = getDialog(shell);
if(dialog.open() == Dialog.OK)
export(shell, terminology, getExporter(dialog), indexedCorpus, path);
} else
// no option dialog
export(shell, terminology, getExporter(), indexedCorpus, path);
}
}
示例3: execute
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Optional TerminologyService terminologyService,
@Optional ETerminoViewerConfig viewerConfig,
@Optional MPart terminologyPart
) {
EList<String> viewerList = viewerConfig.getSelectedPropertyNames();
List<Property<?>> selectedProperties = viewerList
.stream()
.map(s -> PropertyUtil.forName(s)).collect(Collectors.toList());
SelectPropertyDialog dialog = new SelectPropertyDialog(shell, selectedProperties, p-> true, false);
if(dialog.open() == Dialog.OK) {
List<String> propertyNames = dialog.getSelectedPropertyNames();
viewerList.retainAll(propertyNames);
propertyNames.removeAll(viewerList);
viewerList.addAll(propertyNames);
}
}
示例4: execute
@Execute
public void execute(ParameterizedCommand command,
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EPipeline selectedPipeline,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
NLPService extractorService,
ResourceService resourceService) {
Map<String, Object> parameterMap = command.getParameterMap();
boolean useCache = parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE)
&& Boolean.parseBoolean((String) parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE));
if(!parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID)
&& selectedPipeline != null) {
// run handler from selected pipeline
runPipeline(shell, extractorService, resourceService, selectedPipeline, useCache);
} else {
// run handler from parameterized command
String pipelineName = parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID).toString();
java.util.Optional<EPipeline> pipeline = resourceService.getPipeline(pipelineName);
if(pipeline.isPresent())
runPipeline(shell, extractorService, resourceService, pipeline.get(), useCache);
}
}
示例5: execute
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional Object object,
@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
IEclipseContext context) {
BTSText text = null;
if (object instanceof BTSText)
{
text = (BTSText) object;
}
else if (object instanceof BTSTextSelectionEvent && ((BTSTextSelectionEvent) object).data instanceof BTSText)
{
text = (BTSText) ((BTSTextSelectionEvent) object).data;
}
if (text == null) return;
IEclipseContext child = context.createChild();
child.set(BTSText.class, text);
child.set(Shell.class, shell);
CheckTextDialog dialog = ContextInjectionFactory.make(
CheckTextDialog.class, child);
if (dialog.open() == CheckTextDialog.OK) {
}
}
示例6: execute
@Optional
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
IEclipseContext context,
@Optional @Named("org.bbaw.bts.ui.main.commandparameter.dbManagerMessage") String message) {
IEclipseContext child = context.createChild("DBManager");
child.set("dbManagerMessage", message);
if (shell == null)
{
child.set(Shell.class, new Shell());
}
else
{
child.set(Shell.class, shell);
}
DBManagerDialog dialog = ContextInjectionFactory.make(
DBManagerDialog.class, child);
// context.set(UserManagementDialog.class, dialog);
if (dialog.open() == dialog.OK) {
}
}
示例7: execute
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional Object object,
@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
IEclipseContext context) {
BTSCorpusObject corpusObject = null;
if (object instanceof BTSCorpusObject)
{
corpusObject = (BTSCorpusObject) object;
}
else if (object instanceof BTSTextSelectionEvent && ((BTSTextSelectionEvent) object).data instanceof BTSCorpusObject)
{
corpusObject = (BTSCorpusObject) ((BTSTextSelectionEvent) object).data;
}
if (corpusObject == null) return;
IEclipseContext child = context.createChild();
child.set(BTSCorpusObject.class, corpusObject);
child.set(Shell.class, shell);
CheckPassportDialog dialog = ContextInjectionFactory.make(
CheckPassportDialog.class, child);
if (dialog.open() == CheckPassportDialog.OK) {
}
}
示例8: save
@Persist
public void save(MDirtyable dirty, ResourceService resourceService,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
EPipeline pipeline) {
// save changes via ITodoService for example
try {
resourceService.savePipeline(pipeline);
// save was successful
dirty.setDirty(false);
} catch (IOException e) {
MessageDialog.openError(shell, "Save error", e.getMessage());
}
}
示例9: execute
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell parentShell,
IEclipseContext context,
ResourceService resourceService,
CorpusService corpusService) {
Set<String> existingNames = resourceService.getCorporaList().getCorpora().stream().map(ECorpus::getName).collect(Collectors.toSet());
ImportCorpusDialog dialog = new ImportCorpusDialog(parentShell, existingNames, corpusService);
if(dialog.open() == Dialog.OK)
corpusService.createCorpus(
dialog.getCorpus().getName(),
dialog.getCorpus().getPath(),
dialog.getCorpus().getEncoding()
);
}
示例10: execute
@Execute
public void execute(EPartService partService,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
EModelService modelService,
ResourceService resourceService,
ECommandService commandService,
EHandlerService handlerService,
IEclipseContext context,
MApplication mApplication) {
NewPipelineDialog dialog = new NewPipelineDialog(shell, resourceService);
if(dialog.open() == Dialog.OK) {
String filename = dialog.getFilename();
EPipeline pipeline;
try {
pipeline = resourceService.createPipeline(filename);
ParameterizedCommand command = commandService.createCommand(
OpenObjectHandler.COMMAND_ID,
CommandUtil.params(OpenObjectHandler.PARAM_INPUT_OBJECT_ID, resourceService.getResourceId(pipeline)));
if(handlerService.canExecute(command))
handlerService.executeHandler(command);
} catch (IOException e) {
MessageDialog.openError(shell, "Filename error", e.getMessage());
}
}
}
示例11: execute
@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);
}
}
}
}
}
示例12: execute
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EObject selectedObject,
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
ResourceService resourceService,
NLPService extractorService,
CorpusService corpusService) {
RenameDialog dialog = new RenameDialog(shell, resourceService, selectedObject);
if(dialog.open() == Window.OK)
resourceService.rename(selectedObject, dialog.getNewName());
}
示例13: execute
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell parent, NLPService nlpService, ILoggerProvider loggerProvider) {
long megaBytes = FileUtil.folderSize(nlpService.getNlpCachePath().toFile()) / (1024*1024);
if(MessageDialog.openConfirm(parent,
"Clearing the cache",
String.format("The NLP preprocessing cache will be cleared. Space saved: %dMb. Are you sure ?", megaBytes))) {
boolean clearNlpCache = nlpService.clearNlpCache();
if(!clearNlpCache)
MessageDialog.openError(parent, "Error", "Could not remove directory " + nlpService.getNlpCachePath());
}
}
示例14: execute
@Execute
public void execute(
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSTextSelectionEvent event,
@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
EventBroker eventBroker,
BTSTextEditorController textController) {
BTSObject dbbaseObject = (BTSObject) event.data;
if (dbbaseObject != null)
{
final BTSText object = textController
.createNewText((BTSCorpusObject) dbbaseObject);
object.setType(BTSConstants.ANNOTATION_SUBTEXT);
BTSRelation rel = null;
if (object.getRelations().isEmpty())
{
rel = BtsmodelFactory.eINSTANCE.createBTSRelation();
}
else
{
rel = object.getRelations().get(0);
}
rel.setObjectId(dbbaseObject.get_id());
object.getRelations().add(rel);
BTSInterTextReference ref = BtsmodelFactory.eINSTANCE.createBTSInterTextReference();
ref.setBeginId(event.getStartId());
ref.setEndId(event.getEndId());
rel.getParts().add(ref);
textController.save(object);
}
// FIXME eventBroker.post("model_add/BTSAnnotation", object);
}
示例15: execute
@Execute
public void execute(
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional BTSTextSelectionEvent event,
@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell,
EventBroker eventBroker,
CorpusNavigatorController corpusNavigatorController) {
BTSObject dbbaseObject = (BTSObject) event.data;
if (dbbaseObject != null)
{
final BTSAnnotation object = corpusNavigatorController
.createNewAnnotation((BTSCorpusObject) dbbaseObject, BTSConstants.ANNOTATION +
CorpusUtils.TYPE_PATH_DELIMITER + CorpusUtils.ANNOTATION_RUBRUM_TYPE);
object.setName("Rubrum");
BTSRelation rel = null;
if (object.getRelations().isEmpty())
{
rel = BtsmodelFactory.eINSTANCE.createBTSRelation();
object.getRelations().add(rel);
}
else
{
rel = object.getRelations().get(0);
}
rel.setObjectId(dbbaseObject.get_id());
BTSInterTextReference ref = BtsmodelFactory.eINSTANCE.createBTSInterTextReference();
ref.setBeginId(event.getStartId());
ref.setEndId(event.getEndId());
rel.getParts().add(ref);
corpusNavigatorController.save(object);
}
// FIXME eventBroker.post("model_add/BTSAnnotation", object);
}