Skip to content

Commit

Permalink
Add new Eclipse Incremental TreeViewer feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipus committed Sep 21, 2023
1 parent 9cb3b01 commit 9d0a821
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@ public void menuAboutToShow(IMenuManager manager) {
private void fillContextMenu(IMenuManager manager) {
IStructuredSelection selection = ((IStructuredSelection)getViewer().getSelection());
Object selected = selection.getFirstElement();

// Expandable node
if(getViewer().isExandableNode(selected)) {
return;
}

boolean isEmpty = selected == null;

if(isEmpty && fTreeViewer.getInput() instanceof IEditorModelManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.archimatetool.editor.preferences.IPreferenceConstants;
import com.archimatetool.editor.ui.ArchiLabelProvider;
import com.archimatetool.editor.ui.FontFactory;
import com.archimatetool.editor.ui.IArchiImages;
import com.archimatetool.editor.ui.UIUtils;
import com.archimatetool.editor.ui.components.TreeTextCellEditor;
import com.archimatetool.editor.ui.textrender.TextRenderer;
Expand Down Expand Up @@ -106,6 +107,8 @@ public TreeModelViewer(Composite parent, int style) {

setUseHashlookup(true);

setDisplayIncrementally(5000);

// Sort
setComparator(new ViewerComparator(Collator.getInstance()) {
@Override
Expand Down Expand Up @@ -313,6 +316,13 @@ private String getAncestorFolderRenderText(IArchimateModelObject object) {
return null;
}

/**
* Make this public
*/
public boolean isExandableNode(Object element) {
return super.isExpandableNode(element);
}

// ========================= Model Providers =====================================

/**
Expand Down Expand Up @@ -394,6 +404,10 @@ private void resetFonts() {
}

private String getText(Object element) {
if(isExpandableNode(element)) {
return null;
}

// If a Concept or a View's parent or ancestor parent folder has a text expression, evaluate it
String text = getAncestorFolderRenderText((IArchimateModelObject)element);
if(text != null) {
Expand Down Expand Up @@ -423,10 +437,17 @@ private String getText(Object element) {
}

private Image getImage(Object element) {
if(isExpandableNode(element)) {
return IArchiImages.ImageFactory.getImage(IArchiImages.ZOOM_IN);
}
return ArchiLabelProvider.INSTANCE.getImage(element);
}

private Font getFont(Object element) {
if(isExpandableNode(element)) {
return null;
}

boolean isFiltering = false;
boolean unusedConcept = false;

Expand Down

0 comments on commit 9d0a821

Please sign in to comment.