当前位置: 首页>>代码示例>>Java>>正文


Java MPart.getObject方法代码示例

本文整理汇总了Java中org.eclipse.e4.ui.model.application.ui.basic.MPart.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java MPart.getObject方法的具体用法?Java MPart.getObject怎么用?Java MPart.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.e4.ui.model.application.ui.basic.MPart的用法示例。


在下文中一共展示了MPart.getObject方法的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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:32,代码来源:UiBridge.java

示例2: 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;
				}
			}
		}
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:21,代码来源:OccurrencePart.java

示例3: 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;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:OpenObjectByListEntrySelectionFilterDialogHandler.java

示例4: 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);
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:25,代码来源:OpenSearchQueryDialogHandler.java

示例5: 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;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:OpenTypeSubtypeFilterDialogHandler.java

示例6: 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();
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:24,代码来源:RestoreDeletedHandler.java

示例7: 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();
				}
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:DeletePermanentlyHandler.java

示例8: 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;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:FilterOnlyInvalidTextsHandler.java

示例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();
	LemmaNavigator part;
	// see if part has a StructuredViewer
	if (o instanceof LemmaNavigator)
	{
		return true;
	}
	
	return false;
	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:FilterOnlyInvalidLemmataHandler.java

示例10: selectionChanged

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
@Override
public void selectionChanged(MPart part, Object selection) {
	if (part.getObject() instanceof OverviewView) {
		if (selection != null
			&& selection instanceof Person) {
			Person p = (Person) selection;
			activePerson.setFirstName(p.getFirstName());
			activePerson.setLastName(p.getLastName());
			activePerson.setMarried(p.isMarried());
			activePerson.setGender(p.getGender());
		}
		else {
			activePerson.setFirstName(null);
			activePerson.setLastName(null);
			activePerson.setMarried(false);
			activePerson.setGender(null);
		}
	}
}
 
开发者ID:fipro78,项目名称:e4-cookbook-migration-guide,代码行数:20,代码来源:DetailView.java

示例11: getTab

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
@Override
public IDynamicTab getTab(MPart part) {
    IDynamicTab tab = null;
    if (part != null) {
        if (part.getObject() instanceof IDynamicTab) {
            tab = (IDynamicTab) part.getObject();
        }
        else {
            log.error("Given MPart is not a kind of DynamicTab part: " + part.toString()); //$NON-NLS-1$
        }
    }
    else {
        log.error("Part is null"); //$NON-NLS-1$
    }
    return tab;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:17,代码来源:TabServiceImpl.java

示例12: doOtherWindow

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
@Execute
protected void doOtherWindow(@Active MPart apart, @Named(E4CmdHandler.CMD_CTX_KEY)String cmd, @Active EmacsPlusCmdHandler handler) {
	PartAndStack ps = getParentStack(apart); 
	MElementContainer<MUIElement> otherStack = getAdjacentElement(ps.getStack(), ps.getPart(), true);
	MPart other = (MPart)otherStack.getSelectedElement();
	// TODO An egregious hack that may break at any time
	// Is there a defined way of getting the IEditorPart from an MPart?
	if (other.getObject() instanceof CompatibilityEditor) {
		IEditorPart editor = ((CompatibilityEditor) other.getObject()).getEditor();
		try {
			reactivate(other);
			if (handler.isUniversalPresent()) {
				EmacsPlusUtils.executeCommand(cmd, handler.getUniversalCount(), null, editor);
			} else {
				EmacsPlusUtils.executeCommand(cmd, null, editor);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		finally {
			reactivate(apart);
		}
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:25,代码来源:OtherWindowCmd.java

示例13: setActiveTerminology

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
private void setActiveTerminology( EModelService modelService, MApplication application) {
	MPartStack stack = (MPartStack) modelService.find(TermSuiteUI.UI_MAIN_PART_STACK, application);
	MStackElement element = stack.getSelectedElement();
	if(element != null && element instanceof MPart) {
		MPart activePart = (MPart) element;
		if(activePart.getObject() instanceof TerminologyPart)
			updateActiveTerminology((activePart.getContext().get(ETerminology.class)));
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:10,代码来源:StatsPart.java

示例14: activePartChanged

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
@Inject
	void activePartChanged(@Named(IServiceConstants.ACTIVE_PART) MPart part, ETerminologyService eTerminologyService) {
		if(part != null && part.getObject() instanceof TerminologyPart && part.getContext().get(ETerminology.class) != null) {
			ETerminology eTerminology = part.getContext().get(ETerminology.class);
			if(eTerminologyService.readTerminology(eTerminology).getOccurrenceStore().size() == 0) {
//				emptyOccStoreLabel.setText("Occurrence store for terminology " + TerminologyPart.toPartLabel(eTerminology) + " is empty.");
//				emptyOccStoreLabel.setVisible(true);
//				viewer.getControl().setVisible(false);
			} else {
//				emptyOccStoreLabel.setVisible(false);
//				viewer.getControl().setVisible(true);
			}
		}
	}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:15,代码来源:OccurrencePart.java

示例15: canExecute

import org.eclipse.e4.ui.model.application.ui.basic.MPart; //导入方法依赖的package包/类
@CanExecute
public boolean canExecute(MPart part) {
	if(part != null && part.getObject() instanceof TreePart) {
		TreePath[] expandedTreePaths = ((TreePart) part.getObject()).getTreeViewer().getExpandedTreePaths();
		return expandedTreePaths.length > 0;			
	} else
		return false;
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:9,代码来源:CollapseAllHandler.java


注:本文中的org.eclipse.e4.ui.model.application.ui.basic.MPart.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。