本文整理汇总了Java中org.eclipse.e4.ui.workbench.modeling.EPartService.PartState类的典型用法代码示例。如果您正苦于以下问题:Java PartState类的具体用法?Java PartState怎么用?Java PartState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PartState类属于org.eclipse.e4.ui.workbench.modeling.EPartService包,在下文中一共展示了PartState类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectEditorWindow
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的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.workbench.modeling.EPartService.PartState; //导入依赖的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: switchTo
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
void switchTo(MPart newPart) {
if (getOrderedStacks(apart).size() == 1) {
// case 1: 1 frame, split with miniPart
// convenience hack: change direction on uArg
splitIt(newPart, getDirection((isUniversalPresent()) ? !DISPLAY_HORIZONTAL : DISPLAY_HORIZONTAL));
} else {
// case 2: multiple stacks, move to adjacent stack
// get the starting stack
MElementContainer<MUIElement> stack = getParentStack(apart).getStack();
// get the topart's stack
MElementContainer<MUIElement> tstack = getParentStack(newPart).getStack();
stack = findNextStack(apart, stack, 1);
if (stack != null && stack != tstack) {
modelService.move(newPart, stack, 0);
}
}
if (displayOnly) {
// brings to top
partService.showPart(newPart, PartState.VISIBLE);
reactivate(apart);
} else {
// bug in Kepler forces us to activate the old before the new
reactivate(apart);
reactivate(newPart);
}
}
示例4: showMPartForOrder
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
public void showMPartForOrder(final Order order) {
// if already exist we show the part
if (!orderIdToMPartMap.containsKey(order.getId())) {
MPartStack partstack = filterOutOrdersPartStack();
MPart newPart = createAndMapNewPart(order);
partstack.getChildren().add(newPart);
}
MPart part = orderIdToMPartMap.get(order.getId());
partService.showPart(part, PartState.ACTIVATE);
}
示例5: showMPartForPosition
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
public void showMPartForPosition(final PositionWithOrderAndArticleInfoDTO positionViewDTO) {
// if already exist we show the part
MPart mpart = null;
if (positionIdToMPartMap.containsKey(positionViewDTO.getPositionId())) {
mpart = positionIdToMPartMap.get(positionViewDTO.getPositionId());
} else {
MPartStack partstack = filterOutOrdersPartStack();
mpart = createAndMapNewPart(positionViewDTO);
partstack.getChildren().add(mpart);
}
passDataToMPart(positionViewDTO, mpart);
partService.showPart(mpart, PartState.ACTIVATE);
}
示例6: showPart
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
/**
* @param partService
* @param newPart
* @param activePart
*/
private void showPart(EPartService partService, MPart newPart, MPart activePart) {
partService.showPart(newPart, PartState.VISIBLE);
// The current tab will stay active
partService.showPart(stayActiveTab ? activePart : newPart, PartState.ACTIVATE);
}
示例7: openEditor
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
private void openEditor(EPartService partService, IEditorInputResource eir){
String editorPartID = findEditorID(eir);
String resourcePath = eir.getResource().getFullPath().toString();
MPart part = null;
//find existing
for(MPart p : partService.getParts()){
String path = p.getPersistedState().get(AlternativeEditor.ALTERNATIVE_RESOURCE);
if(path != null && path.equals(resourcePath)){
part = p;
}
}
if(part == null){
MPartStack stack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", application);
if(stack != null){
part = partService.createPart(editorPartID);
part.getProperties().put(AlternativeEditor.ALTERNATIVE_RESOURCE, eir.getResource().getFullPath().toString());
stack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE);
}
}
else{
partService.showPart(part, PartState.ACTIVATE);
}
}
示例8: execute
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
@Execute
public void execute(EPartService partService, EModelService modelService, @Named("part_id") String partID) {
MPart part = partService.findPart(partID);
if(part == null){
MPartStack stack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", application);
if(stack != null){
part = partService.createPart(partID);
stack.getChildren().add(part);
}
}
partService.showPart(part, PartState.ACTIVATE);
}
示例9: execute
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
@Execute
public void execute(final EPartService partService, @Optional @Named(IServiceConstants.ACTIVE_SELECTION) final BettingSchedule schedule) {
if (schedule != null) {
MPart part = partService.findPart("optm.bettingschedule.part.bettingSchedule");
part.setVisible(true);
partService.showPart(part, PartState.VISIBLE);
}
}
示例10: init
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
@Inject @Optional
private void init(@UIEventTopic(TermSuiteEvents.JOB_STARTED) String jobName,
EPartService partService) {
partService.showPart(TermSuiteUI.PROGRESS_VIEW_ID, PartState.ACTIVATE);
}
示例11: onDefaultAction
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; //导入依赖的package包/类
@Override
public void onDefaultAction() {
final String editorID = (String)getContext().getLocal(IExplorerConstants.NODE_EDITOR_ID);
if(editorID == null){
logger.warning("Editor id has not been found. IExplorerNode: " + getName());
if(defaultAction != null){
super.onDefaultAction();
}
else if(getResource() instanceof IFile){
//open editor the old way
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, (IFile)getResource());
} catch (PartInitException e) {
e.printStackTrace();
}
}
return;
}
//TODO: find the solution for missing context objects
boolean done = commandExecutor.execute("eu.cloudscaleproject.env.toolchain.openAlternative", getContext());
if(!done){
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
@Override
public void run() {
MPart part = partService.findPart(editorID);
if(part == null){
MPartStack stack = (MPartStack)modelService.find("org.eclipse.e4.primaryDataStack", application);
if(stack != null){
part = partService.createPart(editorID);
stack.getChildren().add(part);
}
}
partService.showPart(part, PartState.ACTIVATE);
//fill in context data
IEclipseContext context = part.getContext();
Object data = getContext().get(IExplorerConstants.NODE_DATA);
if(data != null){
context.set(data.getClass().getName(), data);
}
IResource resource = (IResource)getContext().get(IExplorerConstants.NODE_RESOURCE);
if(resource != null){
context.set(IResource.class, resource);
}
context.set(ExplorerEditorNode.class, ExplorerEditorNode.this);
}
});
}
}