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


Java WorkbenchPlugin类代码示例

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


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

示例1: updateDefaultEditorMappingIfAbsent

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
private void updateDefaultEditorMappingIfAbsent() {
	final EditorRegistry registry = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry();
	for (final IFileEditorMapping editorMapping : registry.getFileEditorMappings()) {
		final IEditorDescriptor defaultEditor = editorMapping.getDefaultEditor();
		if (null == defaultEditor) {

			final String extension = editorMapping.getExtension();
			LOGGER.info("No default editor is associated with files with extension: '." + extension + "'.");
			final IEditorDescriptor defaultTextEditor = registry.findEditor(DEFAULT_TEXT_EDITOR_ID);
			if (null != defaultTextEditor) {
				((FileEditorMapping) editorMapping).setDefaultEditor(defaultTextEditor);
				String editorName = defaultTextEditor.getLabel();
				if (null == editorName) {
					editorName = defaultTextEditor.getId();
				}
				if (null != editorName) {
					LOGGER.info("Associated files with extension " + extension + " with '" + editorName + "'.");
				}
			}
		}
	}
	registry.saveAssociations();
	PrefUtil.savePrefs();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:N4JSApplicationWorkbenchWindowAdvisor.java

示例2: run

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
protected IStatus run(IProgressMonitor monitor) {
	if (monitor.isCanceled()) {
		return new Status(IStatus.CANCEL, WorkbenchPlugin.PI_WORKBENCH,
				IStatus.CANCEL, EMPTY_STRING, null);
	}

	if (FilteredItemsSelectionDialog.this != null) {
		GranualProgressMonitor wrappedMonitor = new GranualProgressMonitor(
				monitor);
		FilteredItemsSelectionDialog.this.reloadCache(true,
				wrappedMonitor);
	}

	if (!monitor.isCanceled()) {
		refreshJob.schedule();
	}

	return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
			EMPTY_STRING, null);

}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:22,代码来源:FilteredItemsSelectionDialog.java

示例3: getKeyBindingService

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
public IKeyBindingService getKeyBindingService() {
	if (service == null) {
		service = getMultiPageEditor().getEditorSite().getKeyBindingService();
		if (service instanceof INestableKeyBindingService) {
			INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
			service = nestableService.getKeyBindingService(this);

		} else {
			/*
			 * This is an internal reference, and should not be copied by client code. If you are thinking of copying this,
			 * DON'T DO IT.
			 */
			WorkbenchPlugin
					.log("MultiPageEditorSite.getKeyBindingService()   Parent key binding service was not an instance of INestableKeyBindingService.  It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
		}
	}
	return service;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:MultiPageToolbarEditorSite.java

示例4: setFont

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
private void setFont(String fontId, FontData[] data)
{
	String fdString = PreferenceConverter.getStoredRepresentation(data);
	// Only set new values if they're different from existing!
	Font existing = JFaceResources.getFont(fontId);
	String existingString = ""; //$NON-NLS-1$
	if (!existing.isDisposed())
	{
		existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData());
	}
	if (!existingString.equals(fdString))
	{
		// put in registry...
		JFaceResources.getFontRegistry().put(fontId, data);
		// Save to prefs...
		ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
		String key = ThemeElementHelper.createPreferenceKey(currentTheme, fontId);
		IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
		store.setValue(key, fdString);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:22,代码来源:ThemePreferencePage.java

示例5: setFont

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
private void setFont(String fontId, FontData[] data) {
	String fdString = PreferenceConverter.getStoredRepresentation(data);

	Font existing = JFaceResources.getFont(fontId);
	String existingString = "";
	if (!(existing.isDisposed())) {
		existingString = PreferenceConverter
				.getStoredRepresentation(existing.getFontData());
	}
	if (existingString.equals(fdString)) {
		return;
	}
	JFaceResources.getFontRegistry().put(fontId, data);

	ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
	String key = ThemeElementHelper.createPreferenceKey(currentTheme,fontId);
	IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
	store.setValue(key, fdString);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:20,代码来源:ThemeUIComposite.java

示例6: addPluginsTab

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
private void addPluginsTab(TabFolder tabFolder) {
	TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
	languageSet.associate(tabItem, Messages.LocalizeDialog_TabTitle_Plugins);

	AboutBundleData[] bundleInfos;



	// create a data object for each bundle, remove duplicates, and include only resolved bundles (bug 65548)
	Map map = new HashMap();
	Bundle[] bundles = WorkbenchPlugin.getDefault().getBundles();
	for (int i = 0; i < bundles.length; ++i) {
		AboutBundleData data = new AboutBundleData(bundles[i]);
		if (BundleUtility.isReady(data.getState()) && !map.containsKey(data.getVersionedId())) {
			map.put(data.getVersionedId(), data);
		}
	}
	bundleInfos = (AboutBundleData[]) map.values().toArray(
			new AboutBundleData[0]);

	Composite c = new Composite(tabFolder, SWT.NONE);
	tabItem.setControl(c);

	createPluginsTab(c, bundleInfos);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:26,代码来源:LocalizeDialog.java

示例7: getWorkbenchErrorHandler

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
@Override
public synchronized AbstractStatusHandler getWorkbenchErrorHandler() {
	return new WorkbenchErrorHandler() {
		@Override
		public void handle(StatusAdapter statusAdapter, int style) {
			if (isClosing) {
				// we are shutting down, so just log
				WorkbenchPlugin.log(statusAdapter.getStatus());
				return;
			}
			if ((style & StatusManager.SHOW) != 0) {
				style = style | StatusManager.BLOCK;
			}
			super.handle(statusAdapter, style);
		}
	};
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:EnsembleWorkbenchAdvisor.java

示例8: getColumnImage

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
public Image getColumnImage(Object element, int index) {
	BindingElement be = (BindingElement) element;
	switch (index) {
	case COMMAND_NAME_COLUMN:
		final String commandId = be.getId();
		final ImageDescriptor imageDescriptor = commandImageService.getImageDescriptor(commandId);
		if (imageDescriptor == null) {
			return null;
		}
		try {
			return localResourceManager.createImage(imageDescriptor);
		} catch (final DeviceResourceException e) {
			final String message = "Problem retrieving image for a command '" //$NON-NLS-1$
					+ commandId + '\'';
			final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
			WorkbenchPlugin.log(message, status);
		}
		return null;
	}

	return null;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:23,代码来源:KeysPreferencePage.java

示例9: loadModelBackend

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
private static BindingManager loadModelBackend(IServiceLocator locator) {
	IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class);
	BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = bindingManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
			if (definedSchemes[i] == bindingService.getActiveScheme()) {
				modelActiveScheme = copy;
			}
		}
		bindingManager.setActiveScheme(modelActiveScheme);
	} catch (final NotDefinedException e) {
		StatusManager.getManager()
				.handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
						"Keys page found an undefined scheme", e)); //$NON-NLS-1$
	}
	bindingManager.setLocale(bindingService.getLocale());
	bindingManager.setPlatform(bindingService.getPlatform());
	bindingManager.setBindings(bindingService.getBindings());
	return bindingManager;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:26,代码来源:KeyController2.java

示例10: createCommand

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
/**
 * Build a command from the executable extension information.
 * 
 * @param commandService
 *            to get the Command object
 * @param commandId
 *            the command id for this action
 * @param parameterMap
 */
private void createCommand(ICommandService commandService,
		String commandId, Map parameterMap) {
	Command cmd = commandService.getCommand(commandId);
	if (!cmd.isDefined()) {
		WorkbenchPlugin.log("Command " + commandId + " is undefined"); //$NON-NLS-1$//$NON-NLS-2$
		return;
	}

	if (parameterMap == null) {
		parameterizedCommand = new ParameterizedCommand(cmd, null);
		return;
	}

	parameterizedCommand = ParameterizedCommand.generateCommand(cmd,
			parameterMap);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:CommandAction.java

示例11: runWithEvent

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
public void runWithEvent(Event event) {
	if (handlerService == null) {
		String commandId = (parameterizedCommand == null ? "unknownCommand" //$NON-NLS-1$
				: parameterizedCommand.getId());
		WorkbenchPlugin.log("Cannot run " + commandId //$NON-NLS-1$
				+ " before command action has been initialized"); //$NON-NLS-1$
		return;
	}
	try {
		if (parameterizedCommand != null) {
			handlerService.executeCommand(parameterizedCommand, event);
		}
	} catch (Exception e) {
		WorkbenchPlugin.log(e);
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:17,代码来源:CommandAction.java

示例12: createFileMenu

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
/**
 * 创建文件菜单
 * @return 返回文件菜单的 menu manager;
 */
private MenuManager createFileMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"),
			IWorkbenchActionConstants.M_FILE); // &File
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
	// 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端
	menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
	menu.add(new Separator());
	menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
	menu.add(new GroupMarker("xliff.switch"));
	menu.add(new GroupMarker("rtf.switch"));
	menu.add(new GroupMarker("xliff.split"));
	menu.add(new Separator());
	// 设置保存文件记录条数为 5 条
	WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5);
	menu.add(new GroupMarker(IWorkbenchActionConstants.HISTORY_GROUP));
	menu.add(exitAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
	return menu;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:24,代码来源:ApplicationActionBarAdvisor.java

示例13: removeUnusedAction

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
/**
 * 移除无用的菜单项:<br/>
 * File 菜单下的“open file...”和“Convert Line Delimiters To”
 */
private void removeUnusedAction() {
	ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
	IActionSetDescriptor[] actionSets = reg.getActionSets();

	List<String> actionSetIds = Arrays.asList("org.eclipse.ui.actionSet.openFiles",
			"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
			"org.eclipse.ui.actions.showKeyAssistHandler", "org.eclipse.ui.edit.text.actionSet.navigation",
			"org.eclipse.ui.edit.text.actionSet.annotationNavigation");
	for (int i = 0; i < actionSets.length; i++) {
		if (actionSetIds.contains(actionSets[i].getId())) {
			IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension();
			reg.removeExtension(ext, new Object[] { actionSets[i] });
		}
	}
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:20,代码来源:ApplicationActionBarAdvisor.java

示例14: runWizardDialog

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
protected void runWizardDialog(final Shell inShell,
        final AbstractExtensionWizard inWizard) {
	final IDialogSettings lWorkbenchSettings = WorkbenchPlugin.getDefault()
	        .getDialogSettings();
	IDialogSettings lWizardSettings = lWorkbenchSettings
	        .getSection("NewWizardAction"); //$NON-NLS-1$
	if (lWizardSettings == null) {
		lWizardSettings = lWorkbenchSettings
		        .addNewSection("NewWizardAction"); //$NON-NLS-1$
	}
	inWizard.setDialogSettings(lWizardSettings);
	inWizard.setForcePreviousAndNextButtons(true);

	final WizardDialog dialog = new WizardDialog(inShell, inWizard);
	dialog.create();
	dialog.open();
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:18,代码来源:AbstractExtensionHandler.java

示例15: NpmExportWizard

import org.eclipse.ui.internal.WorkbenchPlugin; //导入依赖的package包/类
/** */
public NpmExportWizard() {

	IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
	IDialogSettings section = workbenchSettings.getSection("NpmExportWizard");//$NON-NLS-1$
	if (section == null) {
		section = workbenchSettings.addNewSection("NpmExportWizard");//$NON-NLS-1$
	}
	setDialogSettings(section);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:NpmExportWizard.java


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