From 94d6efa70e2f0f6cfdc246a10b2b96fb382901e7 Mon Sep 17 00:00:00 2001 From: Phillipus Date: Mon, 9 Dec 2024 14:26:27 +0000 Subject: [PATCH] 2 --- .../propertysections/UserPropertiesSection.java | 8 +++++++- .../editor/views/tree/search/SearchWidget.java | 10 ++++++++-- .../search/UserPropertiesKeySelectionDialog.java | 16 +++++----------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/UserPropertiesSection.java b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/UserPropertiesSection.java index e9f883f0a..6b6ea39fa 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/UserPropertiesSection.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/UserPropertiesSection.java @@ -523,6 +523,12 @@ private String[] getAllUniquePropertyKeysForModel(int maxSize) { IArchimateModel model = getArchimateModel(); Set set = new LinkedHashSet<>(); // LinkedHashSet is faster when sorting + char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray(); + + for(Integer index = 0; index < 50000; index++) { + model.getProperties().add(IArchimateFactory.eINSTANCE.createProperty(Character.toString(chars[index % 26]) + index, index.toString())); + } + for(Iterator iter = model.eAllContents(); iter.hasNext();) { EObject element = iter.next(); if(element instanceof IProperty p) { @@ -548,7 +554,7 @@ private String[] getAllUniquePropertyKeysForModel(int maxSize) { private String[] getAllUniquePropertyValuesForKeyForModel(String key, int maxSize) { IArchimateModel model = getArchimateModel(); Set set = new LinkedHashSet<>(); // LinkedHashSet is faster when sorting - + for(Iterator iter = model.eAllContents(); iter.hasNext();) { EObject element = iter.next(); if(element instanceof IProperty p) { diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java index 130f65caf..63cb5e0a9 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/SearchWidget.java @@ -49,6 +49,7 @@ import com.archimatetool.editor.ui.components.GlobalActionDisablementHandler; import com.archimatetool.editor.utils.PlatformUtils; import com.archimatetool.editor.utils.StringUtils; +import com.archimatetool.model.IArchimateFactory; import com.archimatetool.model.IArchimateModel; import com.archimatetool.model.IProfile; import com.archimatetool.model.IProfiles; @@ -423,12 +424,17 @@ public ImageDescriptor getImageDescriptor() { } private List getAllUniquePropertyKeys() { - // Maximum amount of items to display when getting all unique keys - final int MAX_ITEMS = 10000; + final int MAX_ITEMS = 200000000; Set set = new LinkedHashSet<>(); // LinkedHashSet is faster when sorting for(IArchimateModel model : IEditorModelManager.INSTANCE.getModels()) { + char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray(); + + for(Integer index = 0; index < 50000; index++) { + model.getProperties().add(IArchimateFactory.eINSTANCE.createProperty(Character.toString(chars[index % 26]) + index, index.toString())); + } + for(Iterator iter = model.eAllContents(); iter.hasNext();) { EObject element = iter.next(); if(element instanceof IProperty property) { diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/UserPropertiesKeySelectionDialog.java b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/UserPropertiesKeySelectionDialog.java index c057bc10a..2e30a401d 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/UserPropertiesKeySelectionDialog.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/search/UserPropertiesKeySelectionDialog.java @@ -7,6 +7,7 @@ import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ILazyContentProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewerColumn; @@ -48,7 +49,7 @@ public class UserPropertiesKeySelectionDialog extends ExtendedTitleAreaDialog { * @param selected A list of property keys to select. Can be null. */ public UserPropertiesKeySelectionDialog(Shell parentShell, List keys, List selected) { - super(parentShell, "UserPropertiesSelectionDialog"); //$NON-NLS-1$ + super(parentShell, "UserPropertiesKeySelectionDialog"); //$NON-NLS-1$ setTitleImage(IArchiImages.ImageFactory.getImage(IArchiImages.ECLIPSE_IMAGE_IMPORT_PREF_WIZARD)); setShellStyle(getShellStyle() | SWT.RESIZE); @@ -94,7 +95,7 @@ protected Control createDialogArea(Composite parent) { return composite; } - private void createTableControl(Composite parent) { + protected void createTableControl(Composite parent) { Composite tableComp = new Composite(parent, SWT.BORDER); TableColumnLayout tableLayout = new TableColumnLayout(); tableComp.setLayout(tableLayout); @@ -135,7 +136,7 @@ public void dispose() { } } - private void createButtonPanel(Composite parent) { + protected void createButtonPanel(Composite parent) { Composite client = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); @@ -177,16 +178,9 @@ protected void buttonPressed(int buttonId) { public List getSelectedKeys() { return selectedKeys; } - - @Override - protected void okPressed() { - super.okPressed(); - - } - + @Override protected Point getDefaultDialogSize() { return new Point(400, 250); } - } \ No newline at end of file