bug TDI-8867 fixed : "generate job " disappear on AMC perspective ,when create a jobscript on TIS .

git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@78811 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
hcyi
2012-02-24 06:16:26 +00:00
parent 4fe77644f7
commit 7282efb46a

View File

@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.action.CoolBarManager;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -101,6 +102,8 @@ public final class PerspectiveReviewUtil {
// MDM View
static String mdmServerViewId = "org.talend.mdm.workbench.views.ServerView";
private static IContributionItem lastPerspective = null;
public static void setPerspectiveReviewUtil() {
// DI
diViewList.add(componentSettingViewerId);
@@ -277,6 +280,8 @@ public final class PerspectiveReviewUtil {
@Override
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
String pId = perspective.getId();
// bug TDI-8867
disappearGenerateJobCoolBar(pId, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
if (null == isfirst || "".equals(isfirst)) {
isfirst = perspective.getId();
refreshAll();
@@ -290,6 +295,23 @@ public final class PerspectiveReviewUtil {
});
}
private static void disappearGenerateJobCoolBar(String pId, IWorkbenchWindow activeWorkbenchWindow) {
if (activeWorkbenchWindow != null && pId != null && !"".equals(pId)) {
CoolBarManager barManager = ((WorkbenchWindow) activeWorkbenchWindow).getCoolBarManager();
if (barManager != null && (barManager instanceof CoolBarManager)) {
IContributionItem diCItem = barManager.find("org.talend.metalanguage.jobscript.JobScript");
if (diCItem != null) {
if (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(pId)) {
lastPerspective = diCItem;
barManager.remove(diCItem);
}
} else if (diCItem == null && lastPerspective != null && IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(pId)) {
barManager.add(lastPerspective);
}
}
}
}
/**
*
* DOC Comment method "refreshAll".