Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2011 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 13-18
Link Here
|
13 |
package org.eclipse.pde.internal.ui.launcher; |
13 |
package org.eclipse.pde.internal.ui.launcher; |
14 |
|
14 |
|
15 |
import java.util.*; |
15 |
import java.util.*; |
|
|
16 |
import java.util.List; |
16 |
import org.eclipse.core.resources.IProject; |
17 |
import org.eclipse.core.resources.IProject; |
17 |
import org.eclipse.core.resources.IResource; |
18 |
import org.eclipse.core.resources.IResource; |
18 |
import org.eclipse.core.runtime.*; |
19 |
import org.eclipse.core.runtime.*; |
Lines 93-98
Link Here
|
93 |
|
94 |
|
94 |
private PluginStatusDialog fDialog; |
95 |
private PluginStatusDialog fDialog; |
95 |
|
96 |
|
|
|
97 |
class PluginModelNameBuffer { |
98 |
private List nameList; |
99 |
|
100 |
PluginModelNameBuffer() { |
101 |
super(); |
102 |
nameList = new ArrayList(); |
103 |
} |
104 |
|
105 |
void add(IPluginModelBase model) { |
106 |
nameList.add(getPluginName(model)); |
107 |
} |
108 |
|
109 |
private String getPluginName(IPluginModelBase model) { |
110 |
String startLevel = null; |
111 |
String autoStart = null; |
112 |
if (fPluginTreeViewer.getChecked(model)) { |
113 |
startLevel = levelColumnCache.get(model) != null ? levelColumnCache.get(model).toString() : null; |
114 |
autoStart = autoColumnCache.get(model) != null ? autoColumnCache.get(model).toString() : null; |
115 |
} |
116 |
return BundleLauncherHelper.writeBundleEntry(model, startLevel, autoStart); |
117 |
} |
118 |
|
119 |
public String toString() { |
120 |
Collections.sort(nameList); |
121 |
StringBuffer result = new StringBuffer(); |
122 |
for (Iterator iterator = nameList.iterator(); iterator.hasNext();) { |
123 |
String name = (String) iterator.next(); |
124 |
if (result.length() > 0) |
125 |
result.append(','); |
126 |
result.append(name); |
127 |
} |
128 |
|
129 |
if (result.length() == 0) |
130 |
return null; |
131 |
|
132 |
return result.toString(); |
133 |
} |
134 |
} |
135 |
|
96 |
/** |
136 |
/** |
97 |
* Label provider for the tree. |
137 |
* Label provider for the tree. |
98 |
*/ |
138 |
*/ |
Lines 103-117
Link Here
|
103 |
} |
143 |
} |
104 |
|
144 |
|
105 |
public String getColumnText(Object obj, int index) { |
145 |
public String getColumnText(Object obj, int index) { |
|
|
146 |
boolean isChecked = fPluginTreeViewer.getChecked(obj); |
106 |
switch (index) { |
147 |
switch (index) { |
107 |
case 0 : |
148 |
case 0 : |
108 |
return super.getColumnText(obj, index); |
149 |
return super.getColumnText(obj, index); |
109 |
case 1 : |
150 |
case 1 : |
110 |
if (levelColumnCache != null && levelColumnCache.containsKey(obj)) |
151 |
if (isChecked && levelColumnCache != null && levelColumnCache.containsKey(obj)) |
111 |
return (String) levelColumnCache.get(obj); |
152 |
return (String) levelColumnCache.get(obj); |
112 |
return ""; //$NON-NLS-1$ |
153 |
return ""; //$NON-NLS-1$ |
113 |
case 2 : |
154 |
case 2 : |
114 |
if (autoColumnCache != null && autoColumnCache.containsKey(obj)) |
155 |
if (isChecked && autoColumnCache != null && autoColumnCache.containsKey(obj)) |
115 |
return (String) autoColumnCache.get(obj); |
156 |
return (String) autoColumnCache.get(obj); |
116 |
return ""; //$NON-NLS-1$ |
157 |
return ""; //$NON-NLS-1$ |
117 |
default : |
158 |
default : |
Lines 596-630
Link Here
|
596 |
protected void resetText(IPluginModelBase model) { |
637 |
protected void resetText(IPluginModelBase model) { |
597 |
String levelText = ""; //$NON-NLS-1$ |
638 |
String levelText = ""; //$NON-NLS-1$ |
598 |
String autoText = ""; //$NON-NLS-1$ |
639 |
String autoText = ""; //$NON-NLS-1$ |
599 |
String systemBundleId = PDECore.getDefault().getModelManager().getSystemBundleId(); |
640 |
|
600 |
boolean isSystemBundle = systemBundleId.equals(model.getPluginBase().getId()); |
|
|
601 |
if (model.isFragmentModel()) { |
602 |
autoText = "false"; //$NON-NLS-1$ |
603 |
} else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(model.getPluginBase().getId()) || "org.eclipse.equinox.ds".equals(model.getPluginBase().getId())) { //$NON-NLS-1$ |
604 |
autoText = "true"; //$NON-NLS-1$ |
605 |
} |
606 |
Widget widget = fPluginTreeViewer.testFindItem(model); |
641 |
Widget widget = fPluginTreeViewer.testFindItem(model); |
607 |
if (fPluginTreeViewer.getChecked(model)) { |
642 |
if (fPluginTreeViewer.getChecked(model)) { |
608 |
if (levelColumnCache.containsKey(model) && !isSystemBundle) { |
643 |
levelText = (String) levelColumnCache.get(model); |
609 |
levelText = (String) levelColumnCache.get(model); |
644 |
levelText = levelText == null || levelText.length() == 0 ? "default" : levelText; //$NON-NLS-1$ |
610 |
levelText = levelText.length() > 0 ? levelText : "default"; //$NON-NLS-1$ |
645 |
autoText = (String) autoColumnCache.get(model); |
611 |
} |
646 |
autoText = autoText == null || autoText.length() == 0 ? "default" : autoText; //$NON-NLS-1$ |
612 |
if (autoColumnCache.containsKey(model) && !isSystemBundle) { |
647 |
|
613 |
autoText = (String) autoColumnCache.get(model); |
648 |
// Replace run levels and auto start values for certain important system bundles |
614 |
autoText = autoText.length() > 0 ? autoText : "default"; //$NON-NLS-1$ |
649 |
String systemValue = BundleLauncherHelper.resolveSystemRunLevelText(model); |
615 |
} |
650 |
levelText = systemValue != null ? systemValue : levelText; |
616 |
} |
651 |
|
617 |
if (levelText != null) { |
652 |
systemValue = BundleLauncherHelper.resolveSystemAutoText(model); |
|
|
653 |
autoText = systemValue != null ? systemValue : autoText; |
654 |
|
655 |
// Recache the values in case they changed. I believe the code to only recache |
656 |
// if they actually changed takes more time than just setting the value. |
618 |
levelColumnCache.put(model, levelText); |
657 |
levelColumnCache.put(model, levelText); |
619 |
if (widget instanceof TreeItem) { |
|
|
620 |
((TreeItem) widget).setText(1, levelText); |
621 |
} |
622 |
} |
623 |
if (autoText != null) { |
624 |
autoColumnCache.put(model, autoText); |
658 |
autoColumnCache.put(model, autoText); |
625 |
if (widget instanceof TreeItem) { |
659 |
} |
626 |
((TreeItem) widget).setText(2, autoText); |
660 |
|
627 |
} |
661 |
// Set values in UI (although I'm not sure why we don't use the label provider here) |
|
|
662 |
if (widget instanceof TreeItem) { |
663 |
((TreeItem) widget).setText(1, levelText); |
664 |
} |
665 |
|
666 |
if (widget instanceof TreeItem) { |
667 |
((TreeItem) widget).setText(2, autoText); |
628 |
} |
668 |
} |
629 |
} |
669 |
} |
630 |
|
670 |
|
Lines 989-1008
Link Here
|
989 |
} |
1029 |
} |
990 |
} |
1030 |
} |
991 |
|
1031 |
|
992 |
protected void appendToBuffer(StringBuffer buffer, IPluginModelBase model) { |
|
|
993 |
if (buffer.length() > 0) |
994 |
buffer.append(","); //$NON-NLS-1$ |
995 |
|
996 |
String startLevel = null; |
997 |
String autoStart = null; |
998 |
if (fPluginTreeViewer.getChecked(model)) { |
999 |
startLevel = levelColumnCache.get(model) != null ? levelColumnCache.get(model).toString() : null; |
1000 |
autoStart = autoColumnCache.get(model) != null ? autoColumnCache.get(model).toString() : null; |
1001 |
} |
1002 |
String value = BundleLauncherHelper.writeBundleEntry(model, startLevel, autoStart); |
1003 |
buffer.append(value); |
1004 |
} |
1005 |
|
1006 |
protected void resetGroup(NamedElement group) { |
1032 |
protected void resetGroup(NamedElement group) { |
1007 |
Widget widget = fPluginTreeViewer.testFindItem(group); |
1033 |
Widget widget = fPluginTreeViewer.testFindItem(group); |
1008 |
if (widget instanceof TreeItem) { |
1034 |
if (widget instanceof TreeItem) { |