下面列出了怎么用org.eclipse.ui.internal.WorkbenchPlugin的API类实例代码及写法,或者点击链接到github查看源代码。
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();
}
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);
}
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);
}
}
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);
}
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;
}
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;
}
/**
* 创建文件菜单
* @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;
}
/**
* 移除无用的菜单项:<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] });
}
}
}
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;
}
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;
}
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;
}
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;
}
public ExportRepositoryWizard(final List<IRepositoryStore<? extends IRepositoryFileStore>> stores, final boolean isZip,
final Set<Object> defaultSelectedFiles, final String defaultFileName, final String wizardTitle) {
this.stores = stores;
setDefaultPageImageDescriptor(Pics.getWizban());
setNeedsProgressMonitor(true);
this.isZip = isZip;
this.wizardTitle = wizardTitle;
this.defaultSelectedFiles = defaultSelectedFiles;
this.defaultFileName = defaultFileName;
setWindowTitle(wizardTitle);
final IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
.getDialogSettings();
IDialogSettings wizardSettings = workbenchSettings
.getSection("ExportRepositoryWizard"); //$NON-NLS-1$
if (wizardSettings == null) {
wizardSettings = workbenchSettings.addNewSection("ExportRepositoryWizard"); //$NON-NLS-1$
}
setDialogSettings(wizardSettings);
}
private void openSuccessDialog(Shell activeShell, IStatus status)
throws LoginException, BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException {
APISession session = BOSEngineManager.getInstance().loginDefaultTenant(Repository.NULL_PROGRESS_MONITOR);
DeployedAppContentProvider contentProvider = new DeployedAppContentProvider(status,
BOSEngineManager.getInstance().getApplicationAPI(session),
BOSEngineManager.getInstance().getProfileAPI(session),
BOSEngineManager.getInstance().getIdentityAPI(session));
if (contentProvider.getItems().length > 0) {
if (IDialogConstants.OPEN_ID == DeploySuccessDialog.open(activeShell, contentProvider,
WorkbenchPlugin.getDefault().getDialogSettings())) {
try {
new OpenBrowserOperation(contentProvider.getSelectedURL()).execute();
} catch (MalformedURLException | UnsupportedEncodingException | URISyntaxException e) {
BonitaStudioLog.error(e);
}
}
} else {
MessageDialog.openWarning(activeShell, Messages.deployStatus, String.format(
Messages.deploySuccessButNoAppToOpenMsg, new ActiveOrganizationProvider().getDefaultUser()));
}
if (session != null) {
BOSEngineManager.getInstance().logoutDefaultTenant(session);
}
}
/**
* Default constructor
*/
public ADocSpecExportWizard() {
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(WIZARD_NAME);// $NON-NLS-1$
if (section == null) {
section = workbenchSettings.addNewSection(WIZARD_NAME);// $NON-NLS-1$
}
setDialogSettings(section);
}
public IStatus runInUIThread(IProgressMonitor monitor) {
if (monitor.isCanceled())
return new Status(IStatus.OK, WorkbenchPlugin.PI_WORKBENCH,
IStatus.OK, EMPTY_STRING, null);
if (FilteredItemsSelectionDialog.this != null) {
FilteredItemsSelectionDialog.this.refresh();
}
return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
EMPTY_STRING, null);
}
/**
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences()
{
final IPreferenceStore uiPreferencesStore = TLCUIActivator.getDefault().getPreferenceStore();
final IPreferenceStore tlcPreferencesStore = TLCActivator.getDefault().getPreferenceStore();
tlcPreferencesStore.setDefault(TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT, 10);
// This is so bad.. we store them in parallel because one is needed by plugin relied upon the PreferencePage
// and the other by a plugin which is on the opposite side of the dependency. (TLCModelLaunchDelegate)
uiPreferencesStore.setDefault(TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT, 10);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_TRACE_MAX_SHOW_ERRORS, 10000);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_POPUP_ERRORS, true);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_REVALIDATE_ON_MODIFY, true);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_DEFAULT_WORKERS_COUNT,
TLCConsumptionProfile.LOCAL_NORMAL.getWorkerThreads());
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_MAXIMUM_HEAP_SIZE_DEFAULT, MAX_HEAP_SIZE_DEFAULT);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_MAXSETSIZE_DEFAULT, TLCGlobals.setBound);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_FPBITS_DEFAULT, 1);
uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_FPSETIMPL_DEFAULT, FPSetFactory.getImplementationDefault());
// store.setDefault(ITLCPreferenceConstants.I_TLC_DELETE_PREVIOUS_FILES, true);
// By default we want the Toolbox to show a modal progress dialog upon TLC
// startup. A user can opt to subsequently suppress the dialog.
// This restores the behavior prior to https://bugs.eclipse.org/146205#c10.
if (!uiPreferencesStore.contains(ITLCPreferenceConstants.I_TLC_SHOW_MODAL_PROGRESS)) {
final IEclipsePreferences node = InstanceScope.INSTANCE
.getNode(WorkbenchPlugin.getDefault().getBundle().getSymbolicName());
node.putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, false);
try {
node.flush();
} catch (final BackingStoreException e) {
TLCUIActivator.getDefault().logError("Error trying to flush the workbench plugin preferences store.",
e);
}
uiPreferencesStore.setValue(ITLCPreferenceConstants.I_TLC_SHOW_MODAL_PROGRESS, true);
}
}
/**
* 创建文件菜单
* @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(newAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
menu.add(new Separator());
menu.add(closeAction);
menu.add(closeAllAction);
menu.add(refreshAction);
// menu.add(new Separator("net.heartsome.cat.ts.ui.menu.file.separator"));
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);
// 添加文件访问列表
ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$
/* (non-javadoc) method declared on ContributionItemFactory */
public IContributionItem create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
return new ReopenEditorMenu(window, getId(), false);
}
};
menu.add(REOPEN_EDITORS.create(window));
menu.add(exitAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
/**
* 移除无用的菜单项:<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");
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] });
}
}
}
public ExportProjectWizard() {
setWindowTitle(Messages.getString("wizard.ExportProjectWizard.title"));
setNeedsProgressMonitor(true);
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings section = workbenchSettings
.getSection("ExportProjectWizard");//$NON-NLS-1$
if (section == null) {
section = workbenchSettings.addNewSection("ExportProjectWizard");//$NON-NLS-1$
}
setDialogSettings(section);
}
protected IDialogSettings getDialogSettings() {
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
if (settings == null) {
settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
}
return settings;
}
/**
* Logs the given exception, and opens an error dialog saying that something went wrong. The exception is assumed to
* have something to do with the preference store.
* @param exception
* The exception to be logged; must not be <code>null</code>.
*/
private final void logPreferenceStoreException(final Throwable exception) {
final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message;
String exceptionMessage = exception.getMessage();
if (exceptionMessage == null) {
exceptionMessage = message;
}
final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
StatusUtil.handleStatus(message, exception, StatusManager.SHOW);
}
protected IDialogSettings getDialogSettings() {
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
if (settings == null) {
settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
}
return settings;
}
/**
* Logs the given exception, and opens an error dialog saying that something went wrong. The exception is assumed to
* have something to do with the preference store.
* @param exception
* The exception to be logged; must not be <code>null</code>.
*/
private final void logPreferenceStoreException(final Throwable exception) {
final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message;
String exceptionMessage = exception.getMessage();
if (exceptionMessage == null) {
exceptionMessage = message;
}
final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
StatusUtil.handleStatus(message, exception, StatusManager.SHOW);
}
/**
* 创建文件菜单
* @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);
// 添加文件访问列表
ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$
/* (non-javadoc) method declared on ContributionItemFactory */
public IContributionItem create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
return new ReopenEditorMenu(window, getId(), false);
}
};
menu.add(REOPEN_EDITORS.create(window));
menu.add(exitAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
/**
* 移除无用的菜单项:<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");
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] });
}
}
}
protected IDialogSettings getDialogSettings() {
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
if (settings == null) {
settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
}
return settings;
}
/**
* Logs the given exception, and opens an error dialog saying that something went wrong. The exception is assumed to
* have something to do with the preference store.
* @param exception
* The exception to be logged; must not be <code>null</code>.
*/
private final void logPreferenceStoreException(final Throwable exception) {
final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message;
String exceptionMessage = exception.getMessage();
if (exceptionMessage == null) {
exceptionMessage = message;
}
final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
StatusUtil.handleStatus(message, exception, StatusManager.SHOW);
}
protected void initializeWorkbenchPreferences() {
IScopeContext context = DefaultScope.INSTANCE;
IEclipsePreferences node = context.getNode(WorkbenchPlugin
.getDefault().getBundle().getSymbolicName());
node.putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, false);
}
public ConfigurationWizardDialog(Shell parentShell, IWizard newWizard) {
super(parentShell, newWizard);
IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
dialogSettings = workbenchSettings.getSection(ConfigurationWizardDialog.class.getName());
if (dialogSettings == null) {
dialogSettings = workbenchSettings.addNewSection(ConfigurationWizardDialog.class.getName());
}
isSimpleMode = dialogSettings.getBoolean(CONFIGURATION_WIZARD_DIALOG_SIMPLE_MODE);
}