|
Lines 66-71
Link Here
|
| 66 |
private static final String ORDERED_ELEMENTS = "orderedElements"; //$NON-NLS-1$ |
66 |
private static final String ORDERED_ELEMENTS = "orderedElements"; //$NON-NLS-1$ |
| 67 |
private static final int MAXIMUM_NUMBER_OF_ELEMENTS = 60; |
67 |
private static final int MAXIMUM_NUMBER_OF_ELEMENTS = 60; |
| 68 |
private static final int MAXIMUM_NUMBER_OF_TEXT_ENTRIES_PER_ELEMENT = 3; |
68 |
private static final int MAXIMUM_NUMBER_OF_TEXT_ENTRIES_PER_ELEMENT = 3; |
|
|
69 |
private static final String DIALOG_HEIGHT = "dialogHeight"; //$NON-NLS-1$ |
| 70 |
private static final String DIALOG_WIDTH = "dialogWidth"; //$NON-NLS-1$ |
| 69 |
|
71 |
|
| 70 |
Shell shell; |
72 |
Shell shell; |
| 71 |
private Text text; |
73 |
private Text text; |
|
Lines 80-85
Link Here
|
| 80 |
private Map<QuickAccessElement, ArrayList<String>> textMap = new HashMap<QuickAccessElement, ArrayList<String>>(); |
82 |
private Map<QuickAccessElement, ArrayList<String>> textMap = new HashMap<QuickAccessElement, ArrayList<String>>(); |
| 81 |
|
83 |
|
| 82 |
private LinkedList<QuickAccessElement> previousPicksList = new LinkedList<QuickAccessElement>(); |
84 |
private LinkedList<QuickAccessElement> previousPicksList = new LinkedList<QuickAccessElement>(); |
|
|
85 |
private int dialogHeight = -1; |
| 86 |
private int dialogWidth = -1; |
| 83 |
|
87 |
|
| 84 |
@PostConstruct |
88 |
@PostConstruct |
| 85 |
void createWidget(final Composite parent, MApplication application, MWindow window) { |
89 |
void createWidget(final Composite parent, MApplication application, MWindow window) { |
|
Lines 108-113
Link Here
|
| 108 |
} |
112 |
} |
| 109 |
|
113 |
|
| 110 |
void doClose() { |
114 |
void doClose() { |
|
|
115 |
dialogHeight = shell.getSize().y; |
| 116 |
dialogWidth = shell.getSize().x; |
| 111 |
} |
117 |
} |
| 112 |
|
118 |
|
| 113 |
QuickAccessElement getPerfectMatch(String filter) { |
119 |
QuickAccessElement getPerfectMatch(String filter) { |
|
Lines 129-134
Link Here
|
| 129 |
shell.addShellListener(new ShellAdapter() { |
135 |
shell.addShellListener(new ShellAdapter() { |
| 130 |
@Override |
136 |
@Override |
| 131 |
public void shellClosed(ShellEvent e) { |
137 |
public void shellClosed(ShellEvent e) { |
|
|
138 |
quickAccessContents.doClose(); |
| 132 |
text.setText(""); //$NON-NLS-1$ |
139 |
text.setText(""); //$NON-NLS-1$ |
| 133 |
e.doit = false; |
140 |
e.doit = false; |
| 134 |
} |
141 |
} |
|
Lines 257-264
Link Here
|
| 257 |
Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width, |
264 |
Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width, |
| 258 |
preferredSize.height); |
265 |
preferredSize.height); |
| 259 |
|
266 |
|
| 260 |
Monitor mon = getClosestMonitor(display, Geometry.centerPoint(result)); |
267 |
Point topLeft = new Point(preferredSize.x, preferredSize.y); |
| 261 |
|
268 |
Monitor mon = getClosestMonitor(display, topLeft); |
| 262 |
Rectangle bounds = mon.getClientArea(); |
269 |
Rectangle bounds = mon.getClientArea(); |
| 263 |
|
270 |
|
| 264 |
if (result.height > bounds.height) { |
271 |
if (result.height > bounds.height) { |
|
Lines 280-287
Link Here
|
| 280 |
Composite parent = text.getParent(); |
287 |
Composite parent = text.getParent(); |
| 281 |
Rectangle tempBounds = parent.getBounds(); |
288 |
Rectangle tempBounds = parent.getBounds(); |
| 282 |
Rectangle compBounds = display.map(parent, null, tempBounds); |
289 |
Rectangle compBounds = display.map(parent, null, tempBounds); |
| 283 |
int width = Math.max(350, compBounds.width); |
290 |
int preferredWidth = dialogWidth == -1 ? 350 : dialogWidth; |
| 284 |
int height = 250; |
291 |
int width = Math.max(preferredWidth, compBounds.width); |
|
|
292 |
int height = dialogHeight == -1 ? 250 : dialogHeight; |
| 293 |
|
| 285 |
shell.setBounds(getConstrainedShellBounds(display, new Rectangle(compBounds.x, compBounds.y |
294 |
shell.setBounds(getConstrainedShellBounds(display, new Rectangle(compBounds.x, compBounds.y |
| 286 |
+ compBounds.height, width, height))); |
295 |
+ compBounds.height, width, height))); |
| 287 |
shell.layout(); |
296 |
shell.layout(); |
|
Lines 305-310
Link Here
|
| 305 |
if (!shell.isDisposed() && !table.isDisposed() && !text.isDisposed()) { |
314 |
if (!shell.isDisposed() && !table.isDisposed() && !text.isDisposed()) { |
| 306 |
if (!shell.isFocusControl() && !table.isFocusControl() |
315 |
if (!shell.isFocusControl() && !table.isFocusControl() |
| 307 |
&& !text.isFocusControl()) { |
316 |
&& !text.isFocusControl()) { |
|
|
317 |
quickAccessContents.doClose(); |
| 308 |
text.setText(""); //$NON-NLS-1$ |
318 |
text.setText(""); //$NON-NLS-1$ |
| 309 |
quickAccessContents.resetProviders(); |
319 |
quickAccessContents.resetProviders(); |
| 310 |
} |
320 |
} |
|
Lines 320-325
Link Here
|
| 320 |
String[] orderedProviders = dialogSettings.getArray(ORDERED_PROVIDERS); |
330 |
String[] orderedProviders = dialogSettings.getArray(ORDERED_PROVIDERS); |
| 321 |
String[] textEntries = dialogSettings.getArray(TEXT_ENTRIES); |
331 |
String[] textEntries = dialogSettings.getArray(TEXT_ENTRIES); |
| 322 |
String[] textArray = dialogSettings.getArray(TEXT_ARRAY); |
332 |
String[] textArray = dialogSettings.getArray(TEXT_ARRAY); |
|
|
333 |
try { |
| 334 |
dialogHeight = dialogSettings.getInt(DIALOG_HEIGHT); |
| 335 |
dialogWidth = dialogSettings.getInt(DIALOG_WIDTH); |
| 336 |
} catch (NumberFormatException e) { |
| 337 |
dialogHeight = -1; |
| 338 |
dialogWidth = -1; |
| 339 |
} |
| 340 |
|
| 323 |
if (orderedElements != null && orderedProviders != null && textEntries != null |
341 |
if (orderedElements != null && orderedProviders != null && textEntries != null |
| 324 |
&& textArray != null) { |
342 |
&& textArray != null) { |
| 325 |
int arrayIndex = 0; |
343 |
int arrayIndex = 0; |
|
Lines 375-380
Link Here
|
| 375 |
dialogSettings.put(ORDERED_PROVIDERS, orderedProviders); |
393 |
dialogSettings.put(ORDERED_PROVIDERS, orderedProviders); |
| 376 |
dialogSettings.put(TEXT_ENTRIES, textEntries); |
394 |
dialogSettings.put(TEXT_ENTRIES, textEntries); |
| 377 |
dialogSettings.put(TEXT_ARRAY, textArray); |
395 |
dialogSettings.put(TEXT_ARRAY, textArray); |
|
|
396 |
dialogSettings.put(DIALOG_HEIGHT, shell.getSize().y); |
| 397 |
dialogSettings.put(DIALOG_WIDTH, shell.getSize().x); |
| 378 |
} |
398 |
} |
| 379 |
|
399 |
|
| 380 |
private IDialogSettings getDialogSettings() { |
400 |
private IDialogSettings getDialogSettings() { |