diff --git a/.gitignore b/.gitignore index 7ac5ed0..fb59ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /.build-*.log /anyedittools-*/ /2.4.15.tar.gz +/2.6.1.tar.gz diff --git a/eclipse-anyedit.spec b/eclipse-anyedit.spec index b868205..e64e2b3 100644 --- a/eclipse-anyedit.spec +++ b/eclipse-anyedit.spec @@ -1,22 +1,16 @@ -%global install_loc %{_datadir}/eclipse/dropins/anyedit - Summary: AnyEdit plugin for eclipse Name: eclipse-anyedit -Version: 2.4.15 -Release: 4%{?dist} +Version: 2.6.1 +Release: 1%{?dist} License: EPL` URL: http://andrei.gmxhome.de/anyedit/index.html Source0: https://github.com/iloveeclipse/anyedittools/archive/%{version}.tar.gz -# Submitted upstream: https://github.com/iloveeclipse/anyedittools/pull/112 -Patch0: support-eclipse-4.5.1.patch - Requires: eclipse-platform -BuildRequires: jpackage-utils -BuildRequires: eclipse-pde -BuildRequires: java-devel +BuildRequires: tycho +BuildRequires: eclipse-jdt BuildArch: noarch %description @@ -25,22 +19,27 @@ Eclipse editors. %prep %setup -q -n anyedittools-%{version} -%patch0 -p1 + +xmvn -o org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms \ + -DgroupId=de.loskutov -Dversion=%{version} + +# don't install poms +%mvn_package "::pom::" __noinstall %build -eclipse-pdebuild +%mvn_build -j %install -# create plugins directory -install -d -m755 ${RPM_BUILD_ROOT}%{install_loc} - -# install plugin -unzip -q -d ${RPM_BUILD_ROOT}%{install_loc} build/rpmBuild/AnyEditTools.zip +%mvn_install -%files -%{install_loc} +%files -f .mfiles %changelog +* Wed Apr 20 2016 Mat Booth - 2.6.1-1 +- Update to latest upstream version +- Drop upstreamed patch +- Build/install with tycho/xmvn + * Wed Feb 03 2016 Fedora Release Engineering - 2.4.15-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 8c1ba4c..2c5dd4a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -434cde001da34545176d96a8f2aa75c9 2.4.15.tar.gz +ea25883e671ad93cd2704b9706843c1f 2.6.1.tar.gz diff --git a/support-eclipse-4.5.1.patch b/support-eclipse-4.5.1.patch deleted file mode 100644 index aea8365..0000000 --- a/support-eclipse-4.5.1.patch +++ /dev/null @@ -1,844 +0,0 @@ -From 76f1a0bcd054c33031863eabcbb2a5872340ad44 Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Fri, 16 Oct 2015 09:34:34 +0100 -Subject: [PATCH] Drop support for ancient versions of the workbench - -(org.eclipse.ui.workbench >= 3.7.0 is now required) - -This allows building anyedit on versions of Eclipse platform >= 4.5.1 ---- - AnyEditTools-feature/feature.xml | 1 + - AnyEditTools/META-INF/MANIFEST.MF | 2 +- - .../src/de/loskutov/anyedit/IAnyEditConstants.java | 3 - - .../anyedit/actions/internal/AnyeditStartup.java | 12 +- - .../actions/internal/SpecialSaveAction.java | 158 ---------- - .../actions/internal/SpecialSaveAllAction.java | 198 ------------- - .../anyedit/actions/internal/StartupHelper.java | 323 --------------------- - .../preferences/AndyEditPreferenceInitializer.java | 1 - - .../ui/preferences/AnyEditPreferencePage.java | 15 - - 9 files changed, 3 insertions(+), 710 deletions(-) - delete mode 100644 AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAction.java - delete mode 100644 AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAllAction.java - delete mode 100644 AnyEditTools/src/de/loskutov/anyedit/actions/internal/StartupHelper.java - -diff --git a/AnyEditTools-feature/feature.xml b/AnyEditTools-feature/feature.xml -index 5746193..7a50b99 100644 ---- a/AnyEditTools-feature/feature.xml -+++ b/AnyEditTools-feature/feature.xml -@@ -46,6 +46,7 @@ All rights reserved. - - - -+ - - - = 0) { -- new StartupHelper2().init(); -- } else { -- new StartupHelper().init(); -- } -- } catch (NoSuchMethodError e){ -- // it's old Eclipse... -- new StartupHelper().init(); -- } -+ new StartupHelper2().init(); - AnyEditToolsPlugin.setSaveHookInitialized(true); - } - -diff --git a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAction.java b/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAction.java -deleted file mode 100644 -index 734e37d..0000000 ---- a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAction.java -+++ /dev/null -@@ -1,158 +0,0 @@ --/******************************************************************************* -- * Copyright (c) 2009 Andrey Loskutov. -- * All rights reserved. This program and the accompanying materials -- * are made available under the terms of the Eclipse Public License v1.0 -- * which accompanies this distribution, and is available at -- * http://www.eclipse.org/legal/epl-v10.html -- * Contributor: Andrey Loskutov - initial API and implementation -- *******************************************************************************/ --package de.loskutov.anyedit.actions.internal; -- --import java.lang.reflect.Field; -- --import org.eclipse.jface.action.Action; --import org.eclipse.jface.action.ActionContributionItem; --import org.eclipse.jface.action.IAction; --import org.eclipse.jface.action.IContributionItem; --import org.eclipse.ui.IEditorPart; --import org.eclipse.ui.IWorkbenchPage; --import org.eclipse.ui.IWorkbenchPart; --import org.eclipse.ui.IWorkbenchWindow; --import org.eclipse.ui.internal.PageEventAction; --import org.eclipse.ui.internal.SaveAction; -- --import de.loskutov.anyedit.AnyEditToolsPlugin; --import de.loskutov.anyedit.IAnyEditConstants; --import de.loskutov.anyedit.actions.Spaces; --import de.loskutov.anyedit.ui.editor.AbstractEditor; --import de.loskutov.anyedit.util.EclipseUtils; -- -- --/** -- * @author Andrey -- */ --public class SpecialSaveAction extends SaveAction implements IDirtyWorkaround { -- -- private final Spaces spacesAction; -- private final IAction spacesToTabs = new DummyAction(IAnyEditConstants.ACTION_ID_CONVERT_SPACES); -- private final IAction tabsToSpaces = new DummyAction(IAnyEditConstants.ACTION_ID_CONVERT_TABS); -- -- /** -- * @param window -- */ -- public SpecialSaveAction(IWorkbenchWindow window) { -- super(window); -- spacesAction = new Spaces(){ -- @Override -- protected AbstractEditor createActiveEditorDelegate() { -- // this just returns the editor instance we already know, see runSpecial() -- return getEditor(); -- } -- @Override -- public void setEditor(AbstractEditor editor) { -- if(editor == null && getEditor() != null){ -- getEditor().dispose(); -- } -- this.editor = editor; -- } -- }; -- spacesAction.setUsedOnSave(true); -- } -- -- /** -- * Performs the 'convert spaces' action before the editor buffer is saved -- */ -- @Override -- public void runBeforeSave() { -- try { -- runSpecial(); -- } catch (Throwable e) { -- // to avoid any problems with any possible environements -- // we trying to catch all errors to allow perform base save action -- AnyEditToolsPlugin.logError("Cannot perform custom pre-save action", e); //$NON-NLS-1$ -- } finally { -- spacesAction.setEditor(null); -- } -- } -- -- @Override -- public void run() { -- runBeforeSave(); -- super.run(); -- } -- -- private void runSpecial() { -- if (getWindow() == null) { -- // action has been disposed -- return; -- } -- IEditorPart part = getActiveEditor(); -- if(part == null) { -- return; -- } -- spacesAction.setActiveEditor(null, part); -- boolean trim = spacesAction.isSaveAndTrimEnabled(); -- boolean convert = spacesAction.isSaveAndConvertEnabled(); -- if(trim || convert){ -- if(EclipseUtils.matchFilter(part, spacesAction.getCombinedPreferences())){ -- return; -- } -- final IAction action; -- if(spacesAction.isDefaultTabToSpaces()){ -- action = tabsToSpaces; -- } else { -- action = spacesToTabs; -- } -- spacesAction.run(action); -- } -- } -- -- @Override -- public void copyStateAndDispose(IContributionItem oldItem){ -- if(oldItem == null || !(oldItem instanceof ActionContributionItem)){ -- return; -- } -- IAction action = ((ActionContributionItem) oldItem).getAction(); -- if(! (action instanceof SaveAction)){ -- return; -- } -- PageEventAction oldAction = (PageEventAction) action; -- IWorkbenchPart activePart = oldAction.getActivePart(); -- if(activePart != null){ -- partActivated(activePart); -- } -- IWorkbenchPage activePage = oldAction.getActivePage(); -- if(activePage != null){ -- pageActivated(activePage); -- } -- // this will remove page/window listeners but will lead to crash on 3.3 shutdown -- IWorkbenchWindow window = oldAction.getWorkbenchWindow(); -- if(window != null){ -- oldAction.dispose(); -- try { -- Field field = PageEventAction.class.getDeclaredField("workbenchWindow"); -- field.setAccessible(true); -- field.set(oldAction, window); -- } catch (Exception e) { -- AnyEditToolsPlugin.logError("Cannot properly dispose save action", e); -- } -- } -- -- } -- -- @Override -- public IWorkbenchWindow getWindow() { -- return getWorkbenchWindow(); -- } -- -- private static final class DummyAction extends Action { -- -- /** -- * @param actionId -- */ -- public DummyAction(String actionId) { -- setId(actionId); -- } -- -- } --} -diff --git a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAllAction.java b/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAllAction.java -deleted file mode 100644 -index 6ff94f9..0000000 ---- a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/SpecialSaveAllAction.java -+++ /dev/null -@@ -1,198 +0,0 @@ --/******************************************************************************* -- * Copyright (c) 2009 Andrey Loskutov. -- * All rights reserved. This program and the accompanying materials -- * are made available under the terms of the Eclipse Public License v1.0 -- * which accompanies this distribution, and is available at -- * http://www.eclipse.org/legal/epl-v10.html -- * Contributor: Andrey Loskutov - initial API and implementation -- *******************************************************************************/ --package de.loskutov.anyedit.actions.internal; -- --import java.lang.reflect.InvocationTargetException; -- --import org.eclipse.core.runtime.IProgressMonitor; --import org.eclipse.jface.action.Action; --import org.eclipse.jface.action.ActionContributionItem; --import org.eclipse.jface.action.IAction; --import org.eclipse.jface.action.IContributionItem; --import org.eclipse.jface.operation.IRunnableWithProgress; --import org.eclipse.ui.IEditorPart; --import org.eclipse.ui.IEditorReference; --import org.eclipse.ui.IViewReference; --import org.eclipse.ui.IWorkbenchPage; --import org.eclipse.ui.IWorkbenchPart; --import org.eclipse.ui.IWorkbenchWindow; --import org.eclipse.ui.PlatformUI; --import org.eclipse.ui.internal.PageEventAction; --import org.eclipse.ui.internal.SaveAllAction; -- --import de.loskutov.anyedit.AnyEditToolsPlugin; --import de.loskutov.anyedit.IAnyEditConstants; --import de.loskutov.anyedit.actions.Spaces; --import de.loskutov.anyedit.ui.editor.AbstractEditor; --import de.loskutov.anyedit.util.EclipseUtils; -- --/** -- * @author Andrey -- */ --public class SpecialSaveAllAction extends SaveAllAction implements IDirtyWorkaround { -- -- private final Spaces spacesAction; -- -- private final IAction spacesToTabs = new DummyAction(IAnyEditConstants.ACTION_ID_CONVERT_SPACES); -- -- private final IAction tabsToSpaces = new DummyAction(IAnyEditConstants.ACTION_ID_CONVERT_TABS); -- -- public SpecialSaveAllAction(IWorkbenchWindow window) { -- super(window); -- spacesAction = new Spaces() { -- @Override -- protected AbstractEditor createActiveEditorDelegate() { -- // this just returns the editor instance we already know, see runSpecial() -- return getEditor(); -- } -- -- @Override -- public void setEditor(AbstractEditor editor) { -- if (editor == null && getEditor() != null) { -- getEditor().dispose(); -- } -- this.editor = editor; -- } -- }; -- spacesAction.setUsedOnSave(true); -- -- IWorkbenchPage page = getActivePage(); -- if (page != null) { -- IEditorReference[] editorReferences = page.getEditorReferences(); -- for (int i = 0; i < editorReferences.length; i++) { -- IWorkbenchPart part = editorReferences[i].getPart(false); -- if (part != null) { -- partOpened(part); -- } -- } -- IViewReference[] viewReferences = page.getViewReferences(); -- for (int i = 0; i < viewReferences.length; i++) { -- IWorkbenchPart part = viewReferences[i].getPart(false); -- if (part != null) { -- partOpened(part); -- } -- } -- } -- } -- -- /** -- * Performs the 'convert spaces' action before the editor buffer is saved -- */ -- @Override -- public void runBeforeSave() { -- try { -- runSpecial(); -- } catch (Throwable e) { -- // to avoid any problems with any possible environements -- // we trying to catch all errors to allow perform base save action -- AnyEditToolsPlugin.logError("Cannot perform custom pre-save action", e); //$NON-NLS-1$ -- } finally { -- spacesAction.setEditor(null); -- } -- } -- -- @Override -- public void run() { -- runBeforeSave(); -- super.run(); -- } -- -- private void runSpecial() { -- if (getWindow() == null) { -- // action has been disposed -- return; -- } -- IWorkbenchPage page = getActivePage(); -- final IEditorPart[] dirtyEditors = page.getDirtyEditors(); -- -- final int editorsCount = dirtyEditors.length; -- if(editorsCount == 0) { -- return; -- } -- IRunnableWithProgress runnable = new IRunnableWithProgress() { -- -- @Override -- public void run(IProgressMonitor monitor) throws InvocationTargetException, -- InterruptedException { -- monitor.beginTask("Converting tabs <-> spaces before save", editorsCount); -- try { -- for (int i = 0; i < editorsCount; i++) { -- if (monitor.isCanceled()) { -- break; -- } -- monitor.worked(1); -- IEditorPart part = dirtyEditors[i]; -- spacesAction.setActiveEditor(null, part); -- boolean trim = spacesAction.isSaveAndTrimEnabled(); -- boolean convert = spacesAction.isSaveAndConvertEnabled(); -- if (trim || convert) { -- if (EclipseUtils.matchFilter(part, -- spacesAction.getCombinedPreferences())) { -- continue; -- } -- monitor.subTask(part.getTitle()); -- final IAction action; -- if (spacesAction.isDefaultTabToSpaces()) { -- action = tabsToSpaces; -- } else { -- action = spacesToTabs; -- } -- spacesAction.run(action); -- } -- } -- } finally { -- monitor.done(); -- } -- } -- }; -- -- try { -- PlatformUI.getWorkbench().getProgressService().run(false, true, runnable); -- } catch (InvocationTargetException e) { -- AnyEditToolsPlugin.logError("Error during custom pre-save action", e); -- } catch (InterruptedException e) { -- // user cancel -- } -- } -- -- @Override -- public void copyStateAndDispose(IContributionItem oldItem) { -- if (oldItem == null || !(oldItem instanceof ActionContributionItem)) { -- return; -- } -- IAction action = ((ActionContributionItem) oldItem).getAction(); -- if (!(action instanceof SaveAllAction)) { -- return; -- } -- PageEventAction oldAction = (PageEventAction) action; -- IWorkbenchPart activePart = oldAction.getActivePart(); -- if (activePart != null) { -- partActivated(activePart); -- } -- IWorkbenchPage activePage = oldAction.getActivePage(); -- if (activePage != null) { -- pageActivated(activePage); -- } -- // this should remove page/window listeners -- oldAction.dispose(); -- } -- -- @Override -- public IWorkbenchWindow getWindow() { -- return getWorkbenchWindow(); -- } -- -- private static final class DummyAction extends Action { -- -- public DummyAction(String actionId) { -- setId(actionId); -- } -- -- } --} -diff --git a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/StartupHelper.java b/AnyEditTools/src/de/loskutov/anyedit/actions/internal/StartupHelper.java -deleted file mode 100644 -index 46dec14..0000000 ---- a/AnyEditTools/src/de/loskutov/anyedit/actions/internal/StartupHelper.java -+++ /dev/null -@@ -1,323 +0,0 @@ --/******************************************************************************* -- * Copyright (c) 2009 Andrey Loskutov. -- * All rights reserved. This program and the accompanying materials -- * are made available under the terms of the Eclipse Public License v1.0 -- * which accompanies this distribution, and is available at -- * http://www.eclipse.org/legal/epl-v10.html -- * Contributor: Andrey Loskutov - initial API and implementation -- *******************************************************************************/ --package de.loskutov.anyedit.actions.internal; -- --import java.lang.reflect.Method; --import java.util.ArrayList; --import java.util.List; -- --import org.eclipse.core.commands.Command; --import org.eclipse.core.commands.ExecutionEvent; --import org.eclipse.core.commands.ExecutionException; --import org.eclipse.core.commands.IExecutionListener; --import org.eclipse.core.commands.NotHandledException; --import org.eclipse.jface.action.ActionContributionItem; --import org.eclipse.jface.action.IContributionItem; --import org.eclipse.jface.action.IContributionManager; --import org.eclipse.jface.action.ICoolBarManager; --import org.eclipse.jface.action.IMenuManager; --import org.eclipse.jface.action.MenuManager; --import org.eclipse.jface.action.ToolBarContributionItem; --import org.eclipse.jface.action.ToolBarManager; --import org.eclipse.jface.preference.IPreferenceStore; --import org.eclipse.ui.IWindowListener; --import org.eclipse.ui.IWorkbench; --import org.eclipse.ui.IWorkbenchWindow; --import org.eclipse.ui.PlatformUI; --import org.eclipse.ui.application.IActionBarConfigurer; --import org.eclipse.ui.application.IWorkbenchWindowConfigurer; --import org.eclipse.ui.commands.ICommandService; --import org.eclipse.ui.internal.WorkbenchWindow; --import org.eclipse.ui.menus.CommandContributionItem; -- --import de.loskutov.anyedit.AnyEditToolsPlugin; --import de.loskutov.anyedit.IAnyEditConstants; -- --/** -- * @author Andrey -- */ --public class StartupHelper implements IWindowListener { -- -- private final List commandListeners; -- -- /** -- * Will be run after workbench is started and w.window is opened -- */ -- public StartupHelper() { -- super(); -- commandListeners = new ArrayList(); -- } -- -- public void init() { -- final IWorkbench workbench = PlatformUI.getWorkbench(); -- workbench.getDisplay().asyncExec(new DirtyHookRunnable()); -- workbench.addWindowListener(this); -- } -- -- /** -- * Very dirty trick to get internal handle to WorkbenchWindowConfigurer. -- * @param ww -- */ -- static IWorkbenchWindowConfigurer getWorkbenchWindowConfigurer(IWorkbenchWindow ww) { -- if (!(ww instanceof WorkbenchWindow)) { -- return null; -- } -- try { -- Method method = WorkbenchWindow.class.getDeclaredMethod( -- "getWindowConfigurer", null); -- method.setAccessible(true); -- Object object = method.invoke(ww, null); -- if (object instanceof IWorkbenchWindowConfigurer) { -- return (IWorkbenchWindowConfigurer) object; -- } -- } catch (Exception e) { -- AnyEditToolsPlugin.logError( -- "Can't get handle for WorkbenchWindowConfigurer", e); //$NON-NLS-1$ -- } -- return null; -- } -- -- @Override -- public void windowOpened(IWorkbenchWindow window) { -- DirtyHookRunnable dh = new DirtyHookRunnable(); -- dh.run(window); -- } -- -- @Override -- public void windowActivated(IWorkbenchWindow window) { -- // ignored -- } -- -- @Override -- public void windowDeactivated(IWorkbenchWindow window) { -- // ignored -- } -- -- @Override -- public void windowClosed(IWorkbenchWindow window) { -- // ignored -- List list = commandListeners; -- for (int i = 0; i < list.size(); i++) { -- PreExecutionHandler listener = list.get(i); -- if(listener.myAction.getWindow() == window) { -- unHookFromCommand(listener); -- } -- } -- } -- -- private void unHookFromCommand(PreExecutionHandler listener) { -- ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService( -- ICommandService.class); -- Command command = service.getCommand(listener.commandId); -- command.removeExecutionListener(listener); -- } -- -- private void hookOnCommand(final IDirtyWorkaround myAction, String commandId) { -- ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService( -- ICommandService.class); -- Command command = service.getCommand(commandId); -- PreExecutionHandler listener = new PreExecutionHandler(myAction, commandId); -- command.addExecutionListener(listener); -- commandListeners.add(listener); -- } -- -- private static final class PreExecutionHandler implements IExecutionListener { -- -- private final IDirtyWorkaround myAction; -- private final String commandId; -- -- private PreExecutionHandler(IDirtyWorkaround myAction, String commandId) { -- this.myAction = myAction; -- this.commandId = commandId; -- } -- -- @Override -- public void notHandled(String command, NotHandledException exception) { -- // -- } -- -- @Override -- public void postExecuteFailure(String command, ExecutionException exception) { -- // -- } -- -- @Override -- public void postExecuteSuccess(String command, Object returnValue) { -- // -- } -- -- @Override -- public void preExecute(String command, ExecutionEvent event) { -- myAction.runBeforeSave(); -- } -- } -- -- private final class DirtyHookRunnable implements Runnable { -- -- private static final String FILE_SAVE_ALL = "org.eclipse.ui.file.saveAll"; -- -- private static final String FILE_SAVE = "org.eclipse.ui.file.save"; -- -- private static final String FILE_MENU = "file"; -- -- private static final String PRINT_BUTTON_ID = "print"; -- -- private static final String FILE_TOOLBAR = "org.eclipse.ui.workbench.file"; -- -- private DirtyHookRunnable() { -- super(); -- } -- -- @Override -- public void run() { -- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); -- if (window == null) { -- return; -- } -- try{ -- run(window); -- } catch (Throwable t){ -- AnyEditToolsPlugin.logError("Can't run dirty code to replace default actions", t); -- } -- } -- -- private void run(IWorkbenchWindow window) { -- IWorkbenchWindowConfigurer wwConf = getWorkbenchWindowConfigurer(window); -- if (wwConf == null) { -- return; -- } -- final SpecialSaveAction mySaveAction = new SpecialSaveAction(window); -- final SpecialSaveAllAction mySaveAllAction = new SpecialSaveAllAction(window); -- -- hookOnCommand(mySaveAction, FILE_SAVE); -- hookOnCommand(mySaveAllAction, FILE_SAVE_ALL); -- -- // override default save action with custom one, wich extend -- // the default action -- IActionBarConfigurer configurer = wwConf.getActionBarConfigurer(); -- configurer.registerGlobalAction(mySaveAction); -- configurer.registerGlobalAction(mySaveAllAction); -- -- IMenuManager menuBar = configurer.getMenuManager(); -- -- // get "file" menu group -- IContributionItem item = menuBar.find(FILE_MENU); -- -- if (item instanceof MenuManager) { -- MenuManager menu = (MenuManager) item; -- // replace menu actions with ours -- insert(mySaveAction, menu); -- insert(mySaveAllAction, menu); -- } -- -- ICoolBarManager coolBar = configurer.getCoolBarManager(); -- // get "file" toolbar group -- item = coolBar.find(FILE_TOOLBAR); -- if (item instanceof ToolBarContributionItem) { -- ToolBarContributionItem item2 = (ToolBarContributionItem) item; -- ToolBarManager manager = (ToolBarManager) item2.getToolBarManager(); -- -- int controlIdx = insert(mySaveAction, manager, -1); -- int nextIndex = controlIdx; -- boolean addSaveAll = getPref(IAnyEditConstants.ADD_SAVE_ALL_TO_TOOLBAR); -- if (addSaveAll) { -- nextIndex++; -- insert(mySaveAllAction, manager, nextIndex); -- } -- boolean removePrint = getPref(IAnyEditConstants.REMOVE_PRINT_FROM_TOOLBAR); -- if (removePrint) { -- nextIndex++; -- remove(manager, nextIndex, PRINT_BUTTON_ID); -- } -- // to resize toolbars after changes... -- coolBar.update(true); -- } -- } -- } -- -- private static void remove(IContributionManager manager, int itemIndex, String id) { -- IContributionItem[] items = manager.getItems(); -- int controlIdx = -1; -- for (int i = 0; i < items.length; i++) { -- if (items[i].isSeparator() || items[i] instanceof ActionContributionItem -- || items[i] instanceof CommandContributionItem) { -- controlIdx++; -- if (controlIdx == itemIndex && id.equals(items[i].getId())) { -- IContributionItem item = manager.remove(items[i]); -- // refresh menu gui -- manager.update(true); -- if (item != null) { -- item.dispose(); -- } -- break; -- } -- } -- } -- } -- -- private static boolean getPref(String prefkey) { -- IPreferenceStore store = AnyEditToolsPlugin.getDefault().getPreferenceStore(); -- return store.getBoolean(prefkey); -- } -- -- private static int insert(IDirtyWorkaround myAction, ToolBarManager manager, -- int controlIdx) { -- IContributionItem item; -- // get "file->save" action -- item = manager.find(myAction.getId()); -- if (item != null) { -- // copy references to opened editor/part -- myAction.copyStateAndDispose(item); -- if (controlIdx < 0) { -- // get/remember position -- IContributionItem[] items = manager.getItems(); -- for (int i = 0; i < items.length; i++) { -- if (items[i].isSeparator() -- || items[i] instanceof ActionContributionItem) { -- controlIdx++; -- if (items[i] == item) { -- break; -- } -- } -- } -- } -- // clean old one -- manager.remove(item); -- item = new ActionContributionItem(myAction); -- manager.insert(controlIdx, item); -- // refresh menu gui -- manager.update(true); -- } else if (controlIdx >= 0) { -- item = new ActionContributionItem(myAction); -- manager.insert(controlIdx, item); -- // refresh menu gui -- manager.update(true); -- } -- return controlIdx; -- } -- -- private static void insert(IDirtyWorkaround myAction, MenuManager menu) { -- IContributionItem item; -- String id = myAction.getId(); -- // get "file->save" action -- item = menu.find(id); -- if (item != null) { -- // copy references to opened editor/part -- myAction.copyStateAndDispose(item); -- // remember position -- int controlIdx = menu.indexOf(id); -- // clean old one -- menu.remove(item); -- item = new ActionContributionItem(myAction); -- menu.insert(controlIdx, item); -- // refresh menu gui -- menu.update(true); -- } -- } --} -diff --git a/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AndyEditPreferenceInitializer.java b/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AndyEditPreferenceInitializer.java -index 6089b0a..b211446 100644 ---- a/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AndyEditPreferenceInitializer.java -+++ b/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AndyEditPreferenceInitializer.java -@@ -64,7 +64,6 @@ AbstractPreferenceInitializer { - store.setDefault(IAnyEditConstants.PREF_INACTIVE_FILTERS_LIST, ""); - store.setDefault(IAnyEditConstants.ASK_BEFORE_CONVERT_ALL_IN_FOLDER, true); - store.setDefault(IAnyEditConstants.INCLUDE_DERIVED_RESOURCES, false); -- store.setDefault(IAnyEditConstants.ADD_SAVE_ALL_TO_TOOLBAR, true); - store.setDefault(IAnyEditConstants.REMOVE_PRINT_FROM_TOOLBAR, false); - store.setDefault(IAnyEditConstants.USE_WORKSPACE_SCOPE_FOR_SEARCH, false); - store.setDefault(IAnyEditConstants.SAVE_TO_OPEN_EDITOR, false); -diff --git a/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AnyEditPreferencePage.java b/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AnyEditPreferencePage.java -index 521afd5..e66dbfa 100644 ---- a/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AnyEditPreferencePage.java -+++ b/AnyEditTools/src/de/loskutov/anyedit/ui/preferences/AnyEditPreferencePage.java -@@ -120,8 +120,6 @@ IWorkbenchPreferencePage, SelectionListener { - - protected Button base64SplitLineCheck; - -- protected Button addSaveAllCheck; -- - protected Button removePrintCheck; - - protected Button hideOpenTypeCheck; -@@ -490,11 +488,6 @@ IWorkbenchPreferencePage, SelectionListener { - gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); - toolbarComposite.setLayoutData(gridData); - toolbarComposite.setText(Messages.pref_toolbarIntro); -- if(EclipseUtils.getWorkbenchVersion().compareTo(new Version(3,7,0)) < 0) { -- addSaveAllCheck = createLabeledCheck(Messages.pref_addSaveAll, -- Messages.pref_addSaveAllTip, -- store.getBoolean(IAnyEditConstants.ADD_SAVE_ALL_TO_TOOLBAR), toolbarComposite); -- } - removePrintCheck = createLabeledCheck(Messages.pref_removePrint, - Messages.pref_removePrintTip, - store.getBoolean(IAnyEditConstants.REMOVE_PRINT_FROM_TOOLBAR), toolbarComposite); -@@ -743,10 +736,6 @@ IWorkbenchPreferencePage, SelectionListener { - replaceAllSpacesCheck.getSelection()); - store.setValue(IAnyEditConstants.PRESERVE_ENTITIES, preserveEntitiesCheck - .getSelection()); -- if(addSaveAllCheck != null) { -- store.setValue(IAnyEditConstants.ADD_SAVE_ALL_TO_TOOLBAR, addSaveAllCheck -- .getSelection()); -- } - if(removePrintCheck != null) { - store.setValue(IAnyEditConstants.REMOVE_PRINT_FROM_TOOLBAR, removePrintCheck - .getSelection()); -@@ -884,10 +873,6 @@ IWorkbenchPreferencePage, SelectionListener { - .getDefaultBoolean(IAnyEditConstants.REPLACE_ALL_SPACES_WITH_TABS)); - preserveEntitiesCheck.setSelection(store - .getDefaultBoolean(IAnyEditConstants.PRESERVE_ENTITIES)); -- if(addSaveAllCheck != null) { -- addSaveAllCheck.setSelection(store -- .getDefaultBoolean(IAnyEditConstants.ADD_SAVE_ALL_TO_TOOLBAR)); -- } - if(removePrintCheck != null) { - removePrintCheck.setSelection(store - .getDefaultBoolean(IAnyEditConstants.REMOVE_PRINT_FROM_TOOLBAR)); --- -2.5.0 -