本文整理汇总了Java中org.eclipse.e4.ui.model.application.ui.basic.MPart类的典型用法代码示例。如果您正苦于以下问题:Java MPart类的具体用法?Java MPart怎么用?Java MPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MPart类属于org.eclipse.e4.ui.model.application.ui.basic包,在下文中一共展示了MPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectEditorWindow
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
/**
* Returns the project window (Swing or SWT).
*
* @param project the project
* @return the project window
*/
public AwbProjectEditorWindow getProjectEditorWindow(Project project) {
AwbProjectEditorWindow projectEditorWindow = null;
switch (this.getVisualisationPlatform()) {
case EclipseFramework:
// --- SWT editor -------------------
MPartStack editorStack = (MPartStack) project.getEclipseEModelService().find(AppModelId.PARTSTACK_ORG_AGENTGUI_CORE_PARTSTACK_EDITOR, project.getEclipseMApplication());
MPart editorPart = project.getEclipseEPartService().createPart(AppModelId.PARTDESCRIPTOR_ORG_AGENTGUI_CORE_PARTDESCRIPTOR_AGENTPROJECT);
if (editorPart!=null) {
editorPart.getTransientData().put(Project.class.getName(), project);
editorPart.setVisible(true);
editorStack.getChildren().add(editorPart);
project.getEclipseEPartService().showPart(editorPart, PartState.VISIBLE);
projectEditorWindow = (AwbProjectEditorWindow) editorPart.getObject();
}
break;
case AgentGuiSwing:
// --- Swing editor -----------------
projectEditorWindow = new org.agentgui.gui.swing.project.ProjectWindow(project);
break;
}
return projectEditorWindow;
}
示例2: openProgressView
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
/**
* Open the progress view in the supplied window.
*
* @param window
*/
// TODO E4
public static void openProgressView() {
Services services = Services.getInstance();
MPart progressView = (MPart) services.getModelService().find(
ProgressManager.PROGRESS_VIEW_NAME, services.getMWindow());
EPartService partService = services.getPartService();
if (progressView == null) {
progressView = partService.createPart(ProgressManager.PROGRESS_VIEW_NAME);
if (progressView != null)
partService.showPart(progressView, PartState.VISIBLE);
}
if (progressView == null) {
return;
}
partService.activate(progressView);
}
示例3: createControls
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@PostConstruct
public void createControls(
IEclipseContext context,
@Preference(nodePath = TermSuiteUI.PLUGIN_ID, value = TermSuiteUIPreferences.WRAP_TEXT) boolean wrap,
final Composite parent,
MPart part,
ILoggerProvider loggerProvider,
EModelService modelService) {
this.logger = loggerProvider.getClassLogger(this.getClass());
parent.setLayout(new FillLayout());
text = new StyledText(parent, getTheStyle(wrap, false));
MToolItem wrapButton = (MToolItem)modelService.find(TOOL_ITEM_WRAP_TEXT, part.getToolbar());
wrapButton.setSelected(wrap);
text.addLineStyleListener(lineStyleListener);
text.addLineBackgroundListener(lineBackgroundListener);
text.setWrapIndent(20);
}
示例4: partBroughtToTop
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Override
public void partBroughtToTop(MPart part) {
if(part != null && part.getObject() instanceof FileEditorPart) {
FileInput<?> fileInput = (FileInput<?>)part.getContext().get(TermSuiteUI.INPUT_OBJECT);
if(fileInput != null && fileInput.getInputObject() instanceof EDocument) {
EDocument doc = (EDocument) fileInput.getInputObject();
if(doc == null) {
logger.warn("Input Object for FileEditorPart " + part.getLabel() + " is null");
return;
}
for(TermOccurrenceContainer<EDocument> toc:documentContainers) {
if(Objects.equal(toc.getContainer(), doc) && !toc.getOccurrences().isEmpty()) {
navigateToOccurrence(toc.getOccurrences().iterator().next());
break;
}
}
}
}
}
示例5: init
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Inject @Optional
private void init(@UIEventTopic(TermSuiteEvents.EDITOR_INITIATED) Object part, MPart mPart) {
if(this == part) {
EPipeline pipeline = (EPipeline) context.get(TermSuiteUI.INPUT_OBJECT);
this.pipelineValue.setValue(pipeline);
this.context.set(EPipeline.class, pipeline);
pipeline.eAdapters().add(new EContentAdapter() {
public void notifyChanged(Notification notification) {
super.notifyChanged(notification);
if(notification.getFeature().equals(TermsuiteuiPackage.eINSTANCE.getEPipeline_Name())) {
mPart.setLabel(notification.getNewStringValue());
} else {
// set dirty, unless this is a pipeline rename
dirty.setDirty(true);
validatePipeline();
}
}
});
validatePipeline();
}
}
示例6: execute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@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);
}
}
示例7: selectionChanged
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
// set the selection to the service
if(selection.size() == 1) {
Object sel = selection.getFirstElement();
TermService t;
if(sel instanceof RelationService)
t = ((RelationService)sel).getTo();
else if(sel instanceof TranslationCandidate)
t = ((TranslationCandidate)sel).getTerm();
else if(sel instanceof TermService)
t = (TermService)sel;
else
throw new IllegalStateException("No such selected type allowed: " + sel.getClass());
selectionService.setSelection(t);
termSuiteSelectionService.setActiveTerm(t);
MPart outlinePart = partService.findPart(TermOutlinePart.ID);
if(outlinePart != null)
partService.bringToTop(outlinePart);
}
}
示例8: insertEditor
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
public void insertEditor(float ratio, int where, MPart containerEditor, MPart editorToInsert) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
EModelService service = window.getService(EModelService.class);
if(secondEditor == null){
secondEditor = getPartStack(editorToInsert);
MArea area = getArea(containerEditor);
MPartSashContainerElement relToElement = area.getChildren().get(0);
service.insert(secondEditor, relToElement, where, ratio);
}else{
if(secondEditor.getChildren().isEmpty()){
//secondEditor.getParent().getChildren().remove(secondEditor);
secondEditor = null;
insertEditor(ratio, where, containerEditor, editorToInsert);
}else{
secondEditor.getChildren().add(editorToInsert);
}
}
}
示例9: canExecute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
// have active part injected via param
// true if active part has a StructuredViewer
Object o = activePart.getObject();
StructuredViewerProvider part;
// see if part has a StructuredViewer
if (o instanceof StructuredViewerProvider)
{
return true;
}
return false;
}
示例10: execute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Execute
public void execute(@Active MPart activePart, @Active Shell shell,
IEclipseContext context, @Optional @Named("org.bbaw.bts.ui.main.commandparameter.viewerFilter") String viewerFilterString,
@Optional @Named("org.bbaw.bts.ui.main.commandparameter.searchString") String searchString,
@Optional @Named("org.bbaw.bts.ui.main.commandparameter.searchOptions") String searchOptions) {
Object o = activePart.getObject();
if (o instanceof SearchViewer) {
SearchViewer searchViewer = (SearchViewer) o;
SimpleSearchQueryDialog dialog = new SimpleSearchQueryDialog(shell);
ContextInjectionFactory.inject(dialog, context);
dialog.create();
dialog.setSearchString(searchString);
if (searchOptions != null) {
dialog.setNameOnly(searchOptions.contains(SearchViewer.OPT_NAME_ONLY));
dialog.setIdOnly(searchOptions.contains(SearchViewer.OPT_ID_ONLY));
}
dialog.setTitle("Object Search");
if (dialog.open() == SimpleSearchQueryDialog.OK) {
if (dialog.getQueryRequest() != null) {
searchViewer.search(dialog.getQueryRequest(), null, viewerFilterString);
}
}
}
}
示例11: canExecute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
// have active part injected via param
// true if active part has a StructuredViewer
Object o = activePart.getObject();
// see if part has a StructuredViewer
if (o instanceof StructuredViewerProvider)
{
return true;
}
return false;
}
示例12: execute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
EditingDomainController editingDomainController,
CorpusCommandController commandController, @Optional @Active MPart activePart) {
System.out.println("restore");
if (selection instanceof EObject) {
((AdministrativDataObject) selection)
.setState(BTSConstants.OBJECT_STATE_ACTIVE);
// General Command Controller... save!
commandController.save((BTSDBBaseObject) selection);
if (activePart != null)
{
Object o = activePart.getObject();
if (o instanceof StructuredViewerProvider)
{
StructuredViewerProvider viewerProvider = (StructuredViewerProvider) o;
viewerProvider.getActiveStructuredViewer().refresh();
}
}
}
}
示例13: execute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@Execute
public void execute(
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
CorpusCommandController commandController, @Optional @Active MPart activePart,
final Shell shell) {
if (selection instanceof BTSDBBaseObject) {
if (MessageDialog.openConfirm(shell,
"Confirm deletion",
"Object will not be recoverable after deletion. Proceed?")) {
commandController.deleteFromDB((BTSDBBaseObject) selection);
if (activePart != null)
{
Object o = activePart.getObject();
if (o instanceof StructuredViewerProvider)
{
StructuredViewerProvider viewerProvider = (StructuredViewerProvider) o;
viewerProvider.getActiveStructuredViewer().refresh();
}
}
}
}
}
示例14: canExecute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
// have active part injected via param
// true if active part has a StructuredViewer
Object o = activePart.getObject();
CorpusNavigatorPart part;
// see if part has a StructuredViewer
if (o instanceof CorpusNavigatorPart)
{
return true;
}
return false;
}
示例15: canExecute
import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入依赖的package包/类
@CanExecute
public boolean canExecute(@Active MPart activePart) {
// have active part injected via param
// true if active part has a StructuredViewer
Object o = activePart.getObject();
LemmaNavigator part;
// see if part has a StructuredViewer
if (o instanceof LemmaNavigator)
{
return true;
}
return false;
}