View | Details | Raw Unified | Return to bug 218618
Collapse All | Expand All

(-)text/org/eclipse/pde/internal/core/text/bundle/ExportPackageObject.java (-10 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 8-24 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Les Jones <lesojones@gmail.com> - Bug 208967
10
 *     Les Jones <lesojones@gmail.com> - Bug 208967
11
 *     Benjamin Cabe <benjamin.cabe@anyware-techc.com> - bug 218618
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.pde.internal.core.text.bundle;
13
package org.eclipse.pde.internal.core.text.bundle;
13
14
14
import java.io.PrintWriter;
15
import java.io.PrintWriter;
15
import java.util.ArrayList;
16
import java.util.*;
16
import java.util.Iterator;
17
import java.util.List;
18
import java.util.ListIterator;
19
import java.util.StringTokenizer;
20
import java.util.TreeMap;
21
22
import org.eclipse.jdt.core.IPackageFragment;
17
import org.eclipse.jdt.core.IPackageFragment;
23
import org.eclipse.osgi.util.ManifestElement;
18
import org.eclipse.osgi.util.ManifestElement;
24
import org.eclipse.pde.core.IModelChangedEvent;
19
import org.eclipse.pde.core.IModelChangedEvent;
Lines 89-113 Link Here
89
	}
84
	}
90
85
91
	public void addFriend(PackageFriend friend) {
86
	public void addFriend(PackageFriend friend) {
87
		boolean oldIsInternal = isInternal();
92
		fFriends.put(friend.getName(), friend);
88
		fFriends.put(friend.getName(), friend);
93
		addDirective(ICoreConstants.FRIENDS_DIRECTIVE, friend.getName());
89
		addDirective(ICoreConstants.FRIENDS_DIRECTIVE, friend.getName());
94
		setDirective(ICoreConstants.INTERNAL_DIRECTIVE, null);
90
		setDirective(ICoreConstants.INTERNAL_DIRECTIVE, null);
95
		fHeader.update();
91
		fHeader.update();
96
		fireStructureChanged(friend, IModelChangedEvent.INSERT);
92
		fireStructureChanged(friend, IModelChangedEvent.INSERT);
93
		firePropertyChanged(this, ICoreConstants.INTERNAL_DIRECTIVE, Boolean.toString(oldIsInternal), Boolean.FALSE.toString());
97
	}
94
	}
98
95
99
	public void removeFriend(PackageFriend friend) {
96
	public void removeFriend(PackageFriend friend) {
97
		boolean hasInternalChanged = false;
100
		fFriends.remove(friend.getName());
98
		fFriends.remove(friend.getName());
101
		setDirective(ICoreConstants.FRIENDS_DIRECTIVE, null);
99
		setDirective(ICoreConstants.FRIENDS_DIRECTIVE, null);
102
		if (fFriends.size() == 0)
100
		if (fFriends.size() == 0) {
103
			setDirective(ICoreConstants.INTERNAL_DIRECTIVE, "true"); //$NON-NLS-1$
101
			setDirective(ICoreConstants.INTERNAL_DIRECTIVE, "true"); //$NON-NLS-1$
104
		else {
102
			hasInternalChanged = true;
103
		} else {
105
			Iterator iter = fFriends.keySet().iterator();
104
			Iterator iter = fFriends.keySet().iterator();
106
			while (iter.hasNext())
105
			while (iter.hasNext())
107
				addDirective(ICoreConstants.FRIENDS_DIRECTIVE, iter.next().toString());
106
				addDirective(ICoreConstants.FRIENDS_DIRECTIVE, iter.next().toString());
108
		}
107
		}
109
		fHeader.update();
108
		fHeader.update();
110
		fireStructureChanged(friend, IModelChangedEvent.REMOVE);
109
		fireStructureChanged(friend, IModelChangedEvent.REMOVE);
110
		if (hasInternalChanged)
111
			firePropertyChanged(this, ICoreConstants.INTERNAL_DIRECTIVE, Boolean.FALSE.toString(), Boolean.TRUE.toString());
112
111
	}
113
	}
112
114
113
	public boolean hasFriend(String name) {
115
	public boolean hasFriend(String name) {
(-)src/org/eclipse/pde/internal/ui/PDELabelProvider.java (-3 / +6 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Benjamin Cabe <benjamin.cabe@anyware-techc.com> - bug 218618
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui;
12
package org.eclipse.pde.internal.ui;
12
13
Lines 887-896 Link Here
887
888
888
	public Image getObjectImage(ExportPackageObject obj) {
889
	public Image getObjectImage(ExportPackageObject obj) {
889
		int flags = 0;
890
		int flags = 0;
890
		if (obj.isInternal())
891
		if (obj.isInternal()) {
891
			flags = F_INTERNAL;
892
			flags = F_INTERNAL;
892
		if (obj.getFriends().length > 0)
893
			// if internal with at least one friend
893
			flags = F_FRIEND;
894
			if (obj.getFriends().length > 0)
895
				flags = F_FRIEND;
896
		}
894
		ImageDescriptor desc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PACKAGE);
897
		ImageDescriptor desc = JavaUI.getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_PACKAGE);
895
		return get(desc, flags);
898
		return get(desc, flags);
896
	}
899
	}

Return to bug 218618