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


Java EPartService类代码示例

本文整理汇总了Java中org.eclipse.e4.ui.workbench.modeling.EPartService的典型用法代码示例。如果您正苦于以下问题:Java EPartService类的具体用法?Java EPartService怎么用?Java EPartService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EPartService类属于org.eclipse.e4.ui.workbench.modeling包,在下文中一共展示了EPartService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openProgressView

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的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);
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:22,代码来源:ProgressManagerUtil.java

示例2: createPartControl

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@PostConstruct
public void createPartControl(Composite parent, EMenuService menuService, Shell shell, EPartService partService, EModelService modelService, MApplication application) {
	// Treeviewer
	this.viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	menuService.registerContextMenu(this.viewer.getControl(),
			"ch.droptilllate.application.popupmenu.table");		
	
	
	this.shell = shell;
	this.parent = parent;
	this.controller = ViewController.getInstance();
	this.controller.initViewController(this.viewer, shell, partService, modelService, application);
	addListeners();
	addCloseListener(parent);
	
}
 
开发者ID:dev131,项目名称:DropTillLate_Application,代码行数:17,代码来源:TreeView.java

示例3: initViewController

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
public void initViewController(TreeViewer viewer, Shell shell, EPartService partService, EModelService modelService, MApplication application) {
	// Treeviewer
	this.viewer = viewer;
	this.shell = shell;
	this.partService = partService;
	this.modelService = modelService;
	this.application = application;
	// Set ContentProvider and Labels
	viewer.setContentProvider(new DropTillLateContentProvider());
	viewer.setLabelProvider(new DropTillLateLabelProvider());
	// Expand the tree
	viewer.setAutoExpandLevel(2);
	// Change TreeTable
	tree = viewer.getTree();
	// Tree table specific code starts fill labels
	tree.setHeaderVisible(true);
	tree.setLinesVisible(true);
	for (TableIdentifier identifier : TableIdentifier.values()) {
		new TreeColumn(tree, SWT.NONE).setText(Messages
				.getTableColumnTitle(identifier));
		tree.getColumn(identifier.ordinal()).setWidth(
				identifier.columnWidth);
	}
	
}
 
开发者ID:dev131,项目名称:DropTillLate_Application,代码行数:26,代码来源:ViewController.java

示例4: execute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Execute
public void execute(MWindow window, EPartService partService,
		EModelService modelService) {
	// assumes you have only two perspectives
	List<MPerspective> perspectives = modelService.findElements(window,
			null, MPerspective.class, null);
	if (perspectives.size() != 2) {
		System.out.println("works only for exactly two perspectives");
	}
	
	MPerspective activePerspective = modelService
			.getActivePerspective(window);
	if (activePerspective.equals(perspectives.get(0))) {
		partService.switchPerspective(perspectives.get(1));
	} else {
		partService.switchPerspective(perspectives.get(0));
	}
}
 
开发者ID:scela,项目名称:EclipseCon2014,代码行数:19,代码来源:SwitchPerspectiveHandler.java

示例5: forceActivate

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
/**
 * Cursor enablement for E4
 */
private void forceActivate() {
	EPartService partService = (EPartService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
	partService.activate(null);
	partService.activate(partService.getActivePart(),true);
	// E4 activation seems slightly hosed - add this in
	EmacsPlusUtils.asyncUiRun(new Runnable() {
		public void run() {
			try {
				// this will finish activating
				EmacsPlusUtils.executeCommand("org.eclipse.ui.window.activateEditor", null);	//$NON-NLS-1$
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:20,代码来源:SwitchToBufferHandler.java

示例6: afterInit

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@PostConstruct
void afterInit(
        final EMenuService inService,
        final EPartService inPartService,
        @Preference(value = RelationsConstants.ACTIVE_BROWSER_ID) @Optional final String inBrowserId) {
	inService.registerContextMenu(styledText.getControl(),
	        RelationsConstants.POPUP_INSPECTOR);

	// work around to have the application's focus on the browser stack
	if (inBrowserId != null) {
		final MPart lBrowser = inPartService.findPart(inBrowserId);
		if (lBrowser != null) {
			inPartService.activate(lBrowser, true);
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:17,代码来源:InspectorView.java

示例7: openURL

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Execute
void openURL(final EPartService inPartService,
        final MApplication inApplication,
        @Named(IServiceConstants.ACTIVE_SHELL) final Shell inShell) {
	final MPart lPart = inPartService
	        .findPart(RelationsConstants.PART_INSPECTOR);
	if (lPart != null) {
		if (lPart.getObject() instanceof ISelectedTextProvider) { // NOPMD
			String lURL = ((ISelectedTextProvider) lPart.getObject())
			        .getSelection();
			if (!lURL.isEmpty()) {
				if (!BrowserUtil.textIsURL(lURL)) {
					lURL = BrowserUtil.PREFIX_HTTP + lURL;
				}
				BrowserUtil.startBrowser(lURL);
			}
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:20,代码来源:OpenURLHandler.java

示例8: activate

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Execute
void activate(final EPartService inPartService,
        final EModelService inModelService, final MApplication inApplication) {
	// get browser stack
	final MPartStack lStack = (MPartStack) inModelService.find(
	        RelationsConstants.PART_STACK_BROWSERS, inApplication);
	final Iterator<MStackElement> lParts = lStack.getChildren().iterator();
	// iterate over children
	while (lParts.hasNext()) {
		final MStackElement lElement = lParts.next();
		if (lElement instanceof MPart) {
			final MPart lPart = (MPart) lElement;
			// activate visible
			if (inPartService.isPartVisible(lPart)) {
				inPartService.activate(lPart, true);
				break;
			}
		}
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:21,代码来源:ActivateViewBrowsers.java

示例9: execute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@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());
		}
	}
	
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:31,代码来源:NewPipelineHandler.java

示例10: execute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的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);
				}
			}
		}

	}

}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:31,代码来源:RemoveResourceHandler.java

示例11: canExecute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@CanExecute
public boolean canExecute(EPartService partService) {
	if (partService != null) {
		return !partService.getDirtyParts().isEmpty();
	}
	return false;
}
 
开发者ID:DrBookings,项目名称:drbookings,代码行数:8,代码来源:SaveHandler.java

示例12: LogViewPart

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Inject
public LogViewPart(final EPartService partService, final IEclipseContext context, final UISynchronize synchronize,
		@Optional final IBundleResourceLoader bundleResourceService) {
	this.synchronize = synchronize;
	this.logTracker = context.get(LogTracker.class);
	this.bundleResourceLoader = bundleResourceService;
}
 
开发者ID:amitjoy,项目名称:Kura-MQTT-Client-Utility,代码行数:8,代码来源:LogViewPart.java

示例13: SubscribePart

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Inject
public SubscribePart(final MApplication application, final IEclipseContext context,
		final UISynchronize uiSynchronize, final IEventBroker broker,
		@Optional final IBundleResourceLoader bundleResourceService, final MWindow window,
		final EPartService partService) {
	this.uiSynchronize = uiSynchronize;
	this.broker = broker;
	this.window = window;
	this.bundleResourceService = context.get(IBundleResourceLoader.class);
	logTracker = context.get(LogTracker.class);
	this.partService = partService;
}
 
开发者ID:amitjoy,项目名称:Kura-MQTT-Client-Utility,代码行数:13,代码来源:SubscribePart.java

示例14: execute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Execute
public void execute(EPartService partService) {
	MPart part = partService.findPart(TextAnnotationsPart.PART_ID);
	if (part == null)
	{
		part = partService.createPart(TextAnnotationsPart.PART_ID);
	}
	partService.activate(part);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:OpenTextAnnotationPartHandler.java

示例15: execute

import org.eclipse.e4.ui.workbench.modeling.EPartService; //导入依赖的package包/类
@Execute
public void execute(EPartService partService, final IWorkbench workbench,
		Shell shell, DBManager dbManager, UISynchronize sync) {
	boolean saveAll = false;
	boolean close = false;
	if (!partService.getDirtyParts().isEmpty()) {
		saveAll = MessageDialog.openConfirm(shell, "Unsaved Data",
				"Unsaved data, do you want to save and restart?");

	} else {
		close = MessageDialog.openConfirm(shell, "Restart",
				"Restart application?");
	}

	if (saveAll) {
		partService.saveAll(false);
	}
	if (close || saveAll) {
		try {
			if (dbManager.optimizationRequired()) {
				// ask user if optimize
				dbManager.optimize();
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		sync.asyncExec(new Runnable() {
			@Override
			public void run() {
				workbench.restart();
			}
		});
	}

}
 
开发者ID:cplutte,项目名称:bts,代码行数:38,代码来源:RestartHandler.java


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