[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Hide elements in [List]Viewer

I mean a thing like this (if you had another way, i can use it):
Taken from the TeamAdmin example.

public class ViewFilterImpl extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element)
{
if (element != null && element instanceof Person)
{
if(element is in the other ListViewer){
return false;
}
}
return true;
}
}



Explanation to your secound statement:
In the Database is save a association between the Leiter and the person. I will delete the Leiter without the person. How can I do this better than below.


Tom Schindl schrieb:
Waldi Waldemar schrieb:
Hi,

My model:
Gruppe - Leiter - Person
   1   - N    1 - 1

I have two ListViewers. There are view things from different resources.
On the left there is a complete list of Persons and on the right one is
the detail from a masterDetail scenario.

Now when I load the application new, all persons are viewed on the left
one. When I add a person to the detail view, the Person is removed from
the left viewer and added to the right. Thats all fine, but i would when
I start the application in the left one all persons are viewed in the
left one without there in the right on.

In my meaning i should implement a Filter, but i have problems with it,
can you help me there?

This are my inputs:
For my Detail ListViewer:
leiterAuswahl.setInput(EMFEditObservables.observeDetailList(Realm
                            .getDefault(), p.getEditingDomain(),
viewerSelection,
                            ZlvpPackage.Literals.GRUPPEN__LEITER));


ViewerFilter?

For my all Persons Viewer:
getPersons is a IObservableList.
leiter.setInput(p.getPersons());

it should be p.getPersons()-ZlvpPackage.Literals.GRUPPEN__LEITER) ;-)

Annother realy easy an short question:
I do this:
Command cmdRemove = RemoveCommand.create(p.getEditingDomain(), gruppe,
ZlvpPackage.Literals.GRUPPEN__LEITER, leiter);

        if (cmdRemove.canExecute()) {
            p.getEditingDomain().getCommandStack().execute(cmdRemove);
            p.getResourcePerson().getContents().add(leiter.getPerson());
        }else{
            System.out.println("Hat ned geklappt");
        }

It works fine but ithink it dirty. Is there another way to delete only a
reference? Only this: Command cmdRemove =
RemoveCommand.create(p.getEditingDomain(), gruppe,
ZlvpPackage.Literals.GRUPPEN__LEITER, leiter);


I'm not sure I understand what you are asking.

Tom