Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 58624 Details for
Bug 133277
[actions] Allow Sort Members to be performed on package and project levels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Provides SortMembersCleanUpAction which uses SortMembersCleanUp
org.eclipse.jdt.ui.sortcleanups.patch (text/plain), 8.15 KB, created by
Alex Blewitt
on 2007-02-08 20:53:04 EST
(
hide
)
Description:
Provides SortMembersCleanUpAction which uses SortMembersCleanUp
Filename:
MIME Type:
Creator:
Alex Blewitt
Created:
2007-02-08 20:53:04 EST
Size:
8.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java,v >retrieving revision 1.18 >diff -u -r1.18 CleanUpAction.java >--- ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java 14 Nov 2006 08:00:09 -0000 1.18 >+++ ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java 9 Feb 2007 01:41:46 -0000 >@@ -51,10 +51,11 @@ > > import org.eclipse.jdt.internal.ui.JavaPlugin; > import org.eclipse.jdt.internal.ui.browsing.LogicalPackage; >+import org.eclipse.jdt.internal.ui.fix.ICleanUp; > import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; > import org.eclipse.jdt.internal.ui.util.ElementValidator; > >-public class CleanUpAction extends SelectionDispatchAction { >+public abstract class CleanUpAction extends SelectionDispatchAction { > > private JavaEditor fEditor; > private IPreferenceChangeListener fPreferenceChangeListener; >@@ -172,7 +173,7 @@ > return; > > try { >- RefactoringExecutionStarter.startCleanupRefactoring(new ICompilationUnit[] {cu}, showWizard(), getShell()); >+ RefactoringExecutionStarter.startCleanupRefactoring(new ICompilationUnit[] {cu}, getCleanUps(), showWizard(), getShell()); > } catch (InvocationTargetException e) { > JavaPlugin.log(e); > if (e.getCause() instanceof CoreException) >@@ -202,7 +203,7 @@ > } > > try { >- RefactoringExecutionStarter.startCleanupRefactoring(cus, showWizard(), getShell()); >+ RefactoringExecutionStarter.startCleanupRefactoring(cus, getCleanUps(), showWizard(), getShell()); > } catch (InvocationTargetException e) { > JavaPlugin.log(e); > if (e.getCause() instanceof CoreException) >@@ -213,6 +214,13 @@ > return; > } > >+ /** >+ * Returns all the cleanups associated with this clean up action. Must not return null; >+ * does not make sense (but legal) to return a zero-element array. >+ * @return an array of ICleanUp >+ */ >+ protected abstract ICleanUp[] getCleanUps(); >+ > private void showUnexpectedError(CoreException e) { > String message2= Messages.format(ActionMessages.CleanUpAction_UnexpectedErrorMessage, e.getStatus().getMessage()); > IStatus status= new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, message2, null); >@@ -302,7 +310,7 @@ > return cu; > } > >- private boolean showWizard() { >+ protected boolean showWizard() { > InstanceScope instanceScope= new InstanceScope(); > IEclipsePreferences instanceNode= instanceScope.getNode(JavaUI.ID_PLUGIN); > if (instanceNode.get(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, null) != null) >Index: core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java,v >retrieving revision 1.38 >diff -u -r1.38 RefactoringExecutionStarter.java >--- core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java 4 Jan 2007 17:23:54 -0000 1.38 >+++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java 9 Feb 2007 01:41:46 -0000 >@@ -227,14 +227,13 @@ > new RefactoringStarter().activate(refactoring, new ChangeTypeWizard(refactoring), shell, RefactoringMessages.ChangeTypeAction_dialog_title, RefactoringSaveHelper.SAVE_JAVA_ONLY_UPDATES); > } > >- public static void startCleanupRefactoring(ICompilationUnit[] cus, boolean showWizard, Shell shell) throws InvocationTargetException, JavaModelException { >+ public static void startCleanupRefactoring(ICompilationUnit[] cus, ICleanUp[] cleanUps, boolean showWizard, Shell shell) throws InvocationTargetException, JavaModelException { > final CleanUpRefactoring refactoring= new CleanUpRefactoring(); > for (int i= 0; i < cus.length; i++) { > refactoring.addCompilationUnit(cus[i]); > } > > if (!showWizard) { >- ICleanUp[] cleanUps= CleanUpRefactoring.createCleanUps(); > for (int i= 0; i < cleanUps.length; i++) { > refactoring.addCleanUp(cleanUps[i]); > } >Index: ui/org/eclipse/jdt/internal/ui/actions/AllCleanUpsAction.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/ui/actions/AllCleanUpsAction.java >diff -N ui/org/eclipse/jdt/internal/ui/actions/AllCleanUpsAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/ui/actions/AllCleanUpsAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Alex Blewitt and others. >+ * 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 >+ * >+ * Contributors: >+ * Alex Blewitt - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.ui.actions; >+ >+import org.eclipse.ui.IWorkbenchSite; >+ >+import org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring; >+ >+import org.eclipse.jdt.internal.ui.fix.ICleanUp; >+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; >+ >+public class AllCleanUpsAction extends CleanUpAction { >+ >+ public AllCleanUpsAction(IWorkbenchSite site) { >+ super(site); >+ } >+ >+ public AllCleanUpsAction(JavaEditor editor) { >+ super(editor); >+ } >+ >+ protected ICleanUp[] getCleanUps() { >+ return CleanUpRefactoring.createCleanUps(); >+ } >+ >+} >Index: ui/org/eclipse/jdt/internal/ui/actions/SortMembersCleanUpAction.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/ui/actions/SortMembersCleanUpAction.java >diff -N ui/org/eclipse/jdt/internal/ui/actions/SortMembersCleanUpAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/ui/actions/SortMembersCleanUpAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 Alex Blewitt and others. >+ * 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 >+ * >+ * Contributors: >+ * Alex Blewitt - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.ui.actions; >+ >+import java.util.Hashtable; >+ >+import org.eclipse.jface.window.Window; >+ >+import org.eclipse.ui.IWorkbenchSite; >+ >+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; >+ >+import org.eclipse.jdt.internal.ui.dialogs.SortMembersMessageDialog; >+import org.eclipse.jdt.internal.ui.fix.ICleanUp; >+import org.eclipse.jdt.internal.ui.fix.SortMembersCleanUp; >+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; >+ >+public class SortMembersCleanUpAction extends CleanUpAction { >+ >+ public SortMembersCleanUpAction(JavaEditor editor) { >+ super(editor); >+ } >+ >+ public SortMembersCleanUpAction(IWorkbenchSite site) { >+ super(site); >+ } >+ >+ protected ICleanUp[] getCleanUps() { >+ SortMembersMessageDialog dialog= new SortMembersMessageDialog(getShell()); >+ if (dialog.open() != Window.OK) { >+ return new ICleanUp[]{}; >+ } >+ Hashtable settings= new Hashtable(); >+ settings.put(CleanUpConstants.SORT_MEMBERS, CleanUpConstants.TRUE); >+ // NB If bug 172801 is not yet applied, then this will be >+ // settings.put(CleanUpConstants.SORT_MEMBERS_ALL, !dialog.isNotSortingFieldsEnabled() ? CleanUpConstants.TRUE: CleanUpConstants.FALSE); >+ settings.put(CleanUpConstants.SORT_MEMBERS_ENUMS, dialog.sortEnums() ? CleanUpConstants.TRUE: CleanUpConstants.FALSE); >+ settings.put(CleanUpConstants.SORT_MEMBERS_FIELDS, dialog.sortFields() ? CleanUpConstants.TRUE: CleanUpConstants.FALSE); >+ return new ICleanUp[]{ new SortMembersCleanUp(settings) }; >+ } >+ >+ protected boolean showWizard() { >+ return false; // we're showing our own >+ } >+ >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 133277
:
57663
|
57664
|
58624
|
62936
|
62938