Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 102390 | Differences between
and this patch

Collapse All | Expand All

(-)src/com/ibm/etools/symptom/editor/internal/util/SymptomEditMessages.java (-19 / +4 lines)
Lines 195-219 Link Here
195
	public static String _185;
195
	public static String _185;
196
	public static String _186;
196
	public static String _186;
197
	
197
	
198
	
198
	public static String _187;
199
	
199
	public static String _188;
200
	
200
	public static String _189;
201
	
201
	public static String _190;
202
	
203
	
204
	
205
	
206
	
207
	
208
	
209
	
210
	
211
	
212
	
213
	
214
	
215
	
216
	
217
	
202
	
218
	
203
	
219
	static {
204
	static {
(-)src/com/ibm/etools/symptom/editor/internal/util/messages.properties (-5 / +4 lines)
Lines 185-195 Link Here
185
_185                   = IBM WebSphere Application Server, Version 6
185
_185                   = IBM WebSphere Application Server, Version 6
186
_186                   = IBM WebSphere Application Server Network Deployment, Version 5
186
_186                   = IBM WebSphere Application Server Network Deployment, Version 5
187
187
188
188
_187 = Sort in ascending order by symptom creation time
189
189
_188 = Sort in descending order by symptom creation time
190
190
_189 = Descending
191
191
_190 = The time the symptom instance generated by the current rule is created.
192
193
192
194
193
195
194
(-)src/com/ibm/etools/symptom/editor/internal/util/SymptomEditorConstants.java (+4 lines)
Lines 26-29 Link Here
26
	public static final String SDB_FILE_NAME_KEY = "sdb_file_name";
26
	public static final String SDB_FILE_NAME_KEY = "sdb_file_name";
27
	
27
	
28
	public static final int PAGE_SIZE = 100;
28
	public static final int PAGE_SIZE = 100;
29
	
30
	public static final String SORT_ORDER = "Descending";
31
	
32
29
}
33
}
(-)plugin.properties (+1 lines)
Lines 48-53 Link Here
48
_UI_RecommendedAction_type_feature = T&ype
48
_UI_RecommendedAction_type_feature = T&ype
49
_UI_RecommendedAction_version_feature = &Version
49
_UI_RecommendedAction_version_feature = &Version
50
_UI_SimpleMatchPattern_expirationTime_feature = &Expiration Time
50
_UI_SimpleMatchPattern_expirationTime_feature = &Expiration Time
51
_UI_AnalysisMatchPattern_creationTime_feature = &Creation Time
51
_UI_SimpleMatchPattern_name_feature = &Name
52
_UI_SimpleMatchPattern_name_feature = &Name
52
_UI_SimpleMatchPattern_priority_feature = &Priority
53
_UI_SimpleMatchPattern_priority_feature = &Priority
53
_UI_SimpleMatchPattern_probability_feature = Pr&obability
54
_UI_SimpleMatchPattern_probability_feature = Pr&obability
(-)src/com/ibm/etools/symptom/editor/internal/SymptomEditorPluginImages.java (+4 lines)
Lines 56-61 Link Here
56
56
57
	public static final String IMG_HORIZONTAL =  "th_horizontal.gif";
57
	public static final String IMG_HORIZONTAL =  "th_horizontal.gif";
58
	public static final String IMG_VERTICAL =  "th_vertical.gif";
58
	public static final String IMG_VERTICAL =  "th_vertical.gif";
59
	public static final String IMG_SORT_ASC =  "sortrecords_ac.gif";
60
	public static final String IMG_SORT_DSC =  "sortrecords_dc.gif";
59
	public static final String IMG_PG_UP =  "pageup.gif";
61
	public static final String IMG_PG_UP =  "pageup.gif";
60
	public static final String IMG_PG_DOWN =  "pagedown.gif";
62
	public static final String IMG_PG_DOWN =  "pagedown.gif";
61
	public static final String IMG_PG_GOTO = "gotopage.gif";
63
	public static final String IMG_PG_GOTO = "gotopage.gif";
Lines 72-77 Link Here
72
	public static final ImageDescriptor DESC_VERTICAL_DISABLED = createManaged(T_DLCL, IMG_VERTICAL); //$NON-NLS-1$
74
	public static final ImageDescriptor DESC_VERTICAL_DISABLED = createManaged(T_DLCL, IMG_VERTICAL); //$NON-NLS-1$
73
	public static final ImageDescriptor DESC_OPEN_LOG_VIEW = createManaged(T_TOOL, IMG_OPEN_LOG_VIEW); //$NON-NLS-1$
75
	public static final ImageDescriptor DESC_OPEN_LOG_VIEW = createManaged(T_TOOL, IMG_OPEN_LOG_VIEW); //$NON-NLS-1$
74
76
77
	public static final ImageDescriptor DESC_SORT_ASC = createManaged(T_ELCL, IMG_SORT_ASC); //$NON-NLS-1$
78
	public static final ImageDescriptor DESC_SORT_DSC = createManaged(T_ELCL, IMG_SORT_DSC); //$NON-NLS-1$
75
	public static final ImageDescriptor DESC_PG_UP = createManaged(T_ELCL, IMG_PG_UP); //$NON-NLS-1$
79
	public static final ImageDescriptor DESC_PG_UP = createManaged(T_ELCL, IMG_PG_UP); //$NON-NLS-1$
76
	public static final ImageDescriptor DESC_PG_DOWN = createManaged(T_ELCL, IMG_PG_DOWN); //$NON-NLS-1$
80
	public static final ImageDescriptor DESC_PG_DOWN = createManaged(T_ELCL, IMG_PG_DOWN); //$NON-NLS-1$
77
	public static final ImageDescriptor DESC_PG_GOTO= createManaged(T_ELCL, IMG_PG_GOTO); //$NON-NLS-1$
81
	public static final ImageDescriptor DESC_PG_GOTO= createManaged(T_ELCL, IMG_PG_GOTO); //$NON-NLS-1$
(-)src/com/ibm/etools/symptom/presentation/SymptomAnalysisViewer.java (-6 / +54 lines)
Lines 10-15 Link Here
10
10
11
package com.ibm.etools.symptom.presentation;
11
package com.ibm.etools.symptom.presentation;
12
12
13
import org.eclipse.core.runtime.Preferences;
13
import org.eclipse.jface.action.Action;
14
import org.eclipse.jface.action.Action;
14
import org.eclipse.jface.action.IToolBarManager;
15
import org.eclipse.jface.action.IToolBarManager;
15
import org.eclipse.jface.dialogs.IInputValidator;
16
import org.eclipse.jface.dialogs.IInputValidator;
Lines 30-35 Link Here
30
import com.ibm.etools.symptom.editor.internal.SymptomEditorPluginImages;
31
import com.ibm.etools.symptom.editor.internal.SymptomEditorPluginImages;
31
import com.ibm.etools.symptom.editor.internal.util.GridUtil;
32
import com.ibm.etools.symptom.editor.internal.util.GridUtil;
32
import com.ibm.etools.symptom.editor.internal.util.SymptomEditMessages;
33
import com.ibm.etools.symptom.editor.internal.util.SymptomEditMessages;
34
import com.ibm.etools.symptom.editor.internal.util.SymptomEditorConstants;
33
import org.eclipse.osgi.util.NLS;
35
import org.eclipse.osgi.util.NLS;
34
36
35
public class SymptomAnalysisViewer extends ViewPart {
37
public class SymptomAnalysisViewer extends ViewPart {
Lines 38-46 Link Here
38
	private SymptomAnalysisPage _currentPage = null;
40
	private SymptomAnalysisPage _currentPage = null;
39
	private String _title = SymptomEditPlugin.INSTANCE.getString("15");
41
	private String _title = SymptomEditPlugin.INSTANCE.getString("15");
40
	private boolean _initializedMenu = false;
42
	private boolean _initializedMenu = false;
41
	private Action _pageUp, _pageDown, _gotoPage;
43
	private Action _sort, _pageUp, _pageDown, _gotoPage;
42
44
	private String STR_SORT_ORDER;
43
44
	/* (non-Javadoc)
45
	/* (non-Javadoc)
45
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
46
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
46
	 */
47
	 */
Lines 50-56 Link Here
50
		
51
		
51
		// Create the default page.
52
		// Create the default page.
52
		_defaultPage = createDefaultPage(_book);
53
		_defaultPage = createDefaultPage(_book);
53
		
54
54
		addViewPage(null);
55
		addViewPage(null);
55
	}
56
	}
56
57
Lines 121-135 Link Here
121
		tbm.removeAll();
122
		tbm.removeAll();
122
		getViewSite().getActionBars().updateActionBars();
123
		getViewSite().getActionBars().updateActionBars();
123
	}
124
	}
125
124
	
126
	
125
	public void makeActions(){
127
	public void makeActions(){
126
		if (isInitializedMenu())
128
		if (isInitializedMenu())
127
			return;
129
			return;
128
		
130
		initializedMenu(true);		 
129
		initializedMenu(true);
131
132
		STR_SORT_ORDER = SymptomEditPlugin.getPlugin().getPreferenceStore().getString(
133
				SymptomEditorConstants.SORT_ORDER); 
134
		if ((STR_SORT_ORDER == null) || (STR_SORT_ORDER.equals("")))
135
					STR_SORT_ORDER=SymptomEditMessages._189; 
136
		_sort = new Action(STR_SORT_ORDER) {
137
			public void run() {
138
				if (_currentPage == null || !(_currentPage instanceof SymptomAnalysisPage))
139
					return;				
140
				BusyIndicator.showWhile(null, new Runnable() {
141
					public void run() {
142
						SymptomAnalysisTreeContentProvider provider = (SymptomAnalysisTreeContentProvider) ((SymptomAnalysisPage) _currentPage).getTreeViewer().getContentProvider();
143
						_sort.setEnabled(provider.sort());
144
						STR_SORT_ORDER = provider.sortTreeViewer(STR_SORT_ORDER);
145
						((SymptomAnalysisPage) _currentPage).update();
146
						Preferences store = SymptomEditPlugin.getPlugin().getPluginPreferences();
147
						store.setValue(SymptomEditorConstants.SORT_ORDER, STR_SORT_ORDER);
148
					}
149
				});
150
			}
151
		};
152
		getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), _sort);
153
		if (STR_SORT_ORDER.equalsIgnoreCase("Descending")){		
154
			SymptomEditorPluginImages.setImageDescriptors(_sort,
155
					SymptomEditorPluginImages.T_LCL,
156
					SymptomEditorPluginImages.IMG_SORT_DSC);
157
			_sort.setDescription(SymptomEditMessages._188);
158
			_sort.setToolTipText(SymptomEditMessages._188);
159
		}
160
		else if (STR_SORT_ORDER.equalsIgnoreCase("Ascending")){
161
			SymptomEditorPluginImages.setImageDescriptors(_sort,
162
					SymptomEditorPluginImages.T_LCL,
163
					SymptomEditorPluginImages.IMG_SORT_ASC);
164
			_sort.setDescription(SymptomEditMessages._187);
165
			_sort.setToolTipText(SymptomEditMessages._187);
166
			
167
		}	
168
			
130
		String STR_PAGE_UP = SymptomEditMessages._123;
169
		String STR_PAGE_UP = SymptomEditMessages._123;
131
		_pageUp = new Action(STR_PAGE_UP) {
170
		_pageUp = new Action(STR_PAGE_UP) {
132
			public void run() {
171
			public void run() {
172
				
173
				
133
				if (_currentPage == null || !(_currentPage instanceof SymptomAnalysisPage))
174
				if (_currentPage == null || !(_currentPage instanceof SymptomAnalysisPage))
134
					return;
175
					return;
135
				
176
				
Lines 221-226 Link Here
221
		_gotoPage.setToolTipText(STR_GO_TO_PAGE);
262
		_gotoPage.setToolTipText(STR_GO_TO_PAGE);
222
263
223
		IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
264
		IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
265
		tbm.add(_sort);
224
		tbm.add(_pageUp);
266
		tbm.add(_pageUp);
225
		tbm.add(_pageDown);
267
		tbm.add(_pageDown);
226
		tbm.add(_gotoPage);
268
		tbm.add(_gotoPage);
Lines 255-260 Link Here
255
		}
297
		}
256
	}
298
	}
257
	
299
	
300
	public Action getSortAction(){
301
		return _sort;
302
	}
303
	
304
258
	public Action getPageUpAction(){
305
	public Action getPageUpAction(){
259
		return _pageUp;
306
		return _pageUp;
260
	}
307
	}
Lines 266-271 Link Here
266
	public Action getGotoPageAction(){
313
	public Action getGotoPageAction(){
267
		return _gotoPage;
314
		return _gotoPage;
268
	}
315
	}
316
	
269
317
270
//	/////////////////
318
//	/////////////////
271
//	public void fakeData(){
319
//	public void fakeData(){
(-)src/com/ibm/etools/symptom/presentation/SymptomAnalysisTreeContentProvider.java (-1 / +60 lines)
Lines 10-23 Link Here
10
package com.ibm.etools.symptom.presentation;
10
package com.ibm.etools.symptom.presentation;
11
11
12
import java.util.ArrayList;
12
import java.util.ArrayList;
13
import java.util.Comparator;
14
import java.util.GregorianCalendar;
13
import java.util.List;
15
import java.util.List;
16
import java.util.Collections;
17
import org.eclipse.hyades.models.symptom.impl.SymptomDescriptionImpl;
14
import org.eclipse.jface.viewers.ITreeContentProvider;
18
import org.eclipse.jface.viewers.ITreeContentProvider;
15
import org.eclipse.jface.viewers.Viewer;
19
import org.eclipse.jface.viewers.Viewer;
16
import com.ibm.etools.symptom.editor.SymptomEditPlugin;
20
import com.ibm.etools.symptom.editor.SymptomEditPlugin;
21
import com.ibm.etools.symptom.editor.internal.SymptomEditorPluginImages;
17
import com.ibm.etools.symptom.editor.internal.util.SymptomEditMessages;
22
import com.ibm.etools.symptom.editor.internal.util.SymptomEditMessages;
18
19
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.osgi.util.NLS;
20
24
25
21
public class SymptomAnalysisTreeContentProvider implements ITreeContentProvider {
26
public class SymptomAnalysisTreeContentProvider implements ITreeContentProvider {
22
	private SymptomAnalysisPage _container;
27
	private SymptomAnalysisPage _container;
23
	private List _allElements = new ArrayList();
28
	private List _allElements = new ArrayList();
Lines 82-87 Link Here
82
		return (getChildren(element).length > 0);
87
		return (getChildren(element).length > 0);
83
	}
88
	}
84
89
90
	private long getSymptomDescriptionCreationTime(SymptomDescriptionImpl item) {
91
		String creationTime = item.getCreationTime().toString();
92
		return( new GregorianCalendar(Integer
93
				.parseInt(creationTime.substring(0, 4)), Integer
94
				.parseInt(creationTime.substring(5, 7)), Integer
95
				.parseInt(creationTime.substring(8, 10)), Integer
96
				.parseInt(creationTime.substring(11, 13)), Integer
97
				.parseInt(creationTime.substring(14, 16)), Integer
98
				.parseInt(creationTime.substring(17))).getTimeInMillis());
99
	}
100
101
	/**
102
	 * Sorts the items in the TreeViewer based on the sortOrder passed as argument and update the sort button
103
	 * @param sortOrder
104
	 * @return
105
	 */
106
	public String  sortTreeViewer(String sortOrder) {
107
		if (sortOrder.equalsIgnoreCase("Descending")) {
108
			List sortedList = _allElements;
109
			Collections.sort(sortedList, new Comparator() {
110
				public int compare(Object o1, Object o2) {
111
					return (getSymptomDescriptionCreationTime((SymptomDescriptionImpl)o1) > getSymptomDescriptionCreationTime((SymptomDescriptionImpl) o2))? -1:1;
112
				}
113
			});
114
			//update the sort button
115
			SymptomEditorPluginImages.setImageDescriptors(_container.getSymptomAnalysisViewer().getSortAction(),
116
					SymptomEditorPluginImages.T_LCL,
117
					SymptomEditorPluginImages.IMG_SORT_ASC);
118
			_container.getSymptomAnalysisViewer().getSortAction().setDescription(SymptomEditMessages._187);
119
			_container.getSymptomAnalysisViewer().getSortAction().setToolTipText(SymptomEditMessages._187);
120
			sortOrder="Ascending";
121
		} else if (sortOrder.equalsIgnoreCase("Ascending")){
122
			List sortedList = _allElements;
123
			Collections.sort(sortedList, new Comparator() {
124
				public int compare(Object o1, Object o2) {
125
					return (getSymptomDescriptionCreationTime((SymptomDescriptionImpl)o1) < getSymptomDescriptionCreationTime((SymptomDescriptionImpl) o2))? -1:1;
126
				}
127
			});
128
			//update the sort button
129
			SymptomEditorPluginImages.setImageDescriptors(_container.getSymptomAnalysisViewer().getSortAction(),
130
						SymptomEditorPluginImages.T_LCL,
131
						SymptomEditorPluginImages.IMG_SORT_DSC);
132
			_container.getSymptomAnalysisViewer().getSortAction().setDescription(SymptomEditMessages._188);
133
			_container.getSymptomAnalysisViewer().getSortAction().setToolTipText(SymptomEditMessages._188);
134
			sortOrder="Descending";
135
		}		
136
		return sortOrder;
137
	}
138
139
	public boolean sort(){
140
		return _allElements.size() > 1; 
141
	}
142
85
	public boolean pageUp(){
143
	public boolean pageUp(){
86
		if (_currentPage > 0){
144
		if (_currentPage > 0){
87
			_currentPage--;
145
			_currentPage--;
Lines 138-143 Link Here
138
	
196
	
139
	private void updatePageActions(){
197
	private void updatePageActions(){
140
		try{
198
		try{
199
			_container.getSymptomAnalysisViewer().getSortAction().setEnabled(_allElements.size() > 1);
141
			_container.getSymptomAnalysisViewer().getPageUpAction().setEnabled(_currentPage > 0);
200
			_container.getSymptomAnalysisViewer().getPageUpAction().setEnabled(_currentPage > 0);
142
			_container.getSymptomAnalysisViewer().getPageDownAction().setEnabled((_totalPages - _currentPage) > 1);
201
			_container.getSymptomAnalysisViewer().getPageDownAction().setEnabled((_totalPages - _currentPage) > 1);
143
			_container.getSymptomAnalysisViewer().getGotoPageAction().setEnabled(_totalPages > 1);
202
			_container.getSymptomAnalysisViewer().getGotoPageAction().setEnabled(_totalPages > 1);
(-)icons/full/dlcl16/sortrecords_ac.gif (+1 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,)HºÜM¸×¸“TrûÜÊ?i?˜?܈š_©º'Ü4me5Ã:€<þÀE;
(-)icons/full/clcl16/sortrecords_dc.gif (+2 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,+HºÜ>
2
¸¸“TrûÜJ?i?˜?„ù•#ª>ì7C]//c39#Ì£ p‘;
(-)icons/full/elcl16/sortrecords_ac.gif (+1 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,)HºÜM¸×¸“TrûÜÊ?i?˜?܈š_©º'Ü4me5Ã:€<þÀE;
(-)icons/full/dlcl16/sortrecords_dc.gif (+2 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,+HºÜ>
2
¸¸“TrûÜJ?i?˜?„ù•#ª>ì7C]//c39#Ì£ p‘;
(-)icons/full/elcl16/sortrecords_dc.gif (+2 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,+HºÜ>
2
¸¸“TrûÜJ?i?˜?„ù•#ª>ì7C]//c39#Ì£ p‘;
(-)icons/full/clcl16/sortrecords_ac.gif (+1 lines)
Added Link Here
1
GIF89a¢ÁÆÙ«ÖëLZ]O[[ÿÿÿ!ù,)HºÜM¸×¸“TrûÜÊ?i?˜?܈š_©º'Ü4me5Ã:€<þÀE;

Return to bug 102390