Compare commits
1 Commits
cmeng/stig
...
cmeng/feat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88b3ba7aad |
@@ -4,6 +4,7 @@ Bundle-Name: -Talend Open Studio -
|
||||
Bundle-SymbolicName: org.talend.rcp;singleton:=true
|
||||
Bundle-Version: 8.0.1.qualifier
|
||||
Bundle-Activator: org.talend.rcp.Activator
|
||||
Bundle-Localization: plugin
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui.intro,
|
||||
org.talend.core,
|
||||
|
||||
@@ -3,6 +3,7 @@ bin.includes = plugin.xml,\
|
||||
.,\
|
||||
content/,\
|
||||
icons/,\
|
||||
plugin.properties,\
|
||||
META-INF/
|
||||
source.. = src/main/java/
|
||||
bin.excludes = icons/notuse/
|
||||
|
||||
1
main/plugins/org.talend.rcp/plugin.properties
Normal file
1
main/plugins/org.talend.rcp/plugin.properties
Normal file
@@ -0,0 +1 @@
|
||||
resources.label = Resources
|
||||
@@ -366,5 +366,23 @@
|
||||
id="org.talend.rcp.perspective">
|
||||
</perspective>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.actionSets">
|
||||
|
||||
<actionSet
|
||||
label="Talend Resources"
|
||||
visible="true"
|
||||
id="org.talend.actionSet">
|
||||
|
||||
|
||||
<action
|
||||
id="org.eclipse.debug.internal.ui.actions.Resources"
|
||||
toolbarPath="talend.group"
|
||||
class="org.talend.rcp.action.toolbar.CreatResourcesToolbarAction"
|
||||
label="%resources.label"
|
||||
style="pulldown">
|
||||
</action>
|
||||
|
||||
</actionSet>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -112,4 +112,4 @@ DataTransferMessages.ArchiveExport_selectDestinationTitle=Export to Archive File
|
||||
WorkbenchMessages.ShowView_errorTitle=Problems Showing View
|
||||
ComponentsManager.form.install.dialog.restart.title=Restarting Studio
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
JavaVersion.CheckError=Java upgrade required, minimal required java version is {0}, current version is {1}.
|
||||
JavaVersion.CheckError=Java upgrade required, minimal required java version is {0}, current version is {1}.
|
||||
@@ -0,0 +1,265 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.rcp.action.toolbar;
|
||||
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuCreator;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MenuAdapter;
|
||||
import org.eclipse.swt.events.MenuEvent;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.ui.IActionDelegate2;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
|
||||
import org.eclipse.ui.internal.WWinPluginPulldown;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||
import org.talend.core.model.utils.TalendPropertiesUtil;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.ui.views.IRepositoryView;
|
||||
import org.talend.rcp.i18n.Messages;
|
||||
|
||||
/**
|
||||
* DOC qwei class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 1 2006-09-29 17:06:40 +0000 (ææäº, 29 乿 2006) nrousseau $
|
||||
*
|
||||
*/
|
||||
public class CreatResourcesToolbarAction implements IWorkbenchWindowPulldownDelegate2, IActionDelegate2 {
|
||||
|
||||
/**
|
||||
* The menu created by this action
|
||||
*/
|
||||
private Menu fMenu;
|
||||
|
||||
protected boolean fRecreateMenu = false;
|
||||
|
||||
protected IWorkbenchWindow window;
|
||||
|
||||
public static final String LEARN = "Learn"; //$NON-NLS-1$
|
||||
|
||||
public static final String LEARN_ORIG_URL = "https://help.talend.com";
|
||||
|
||||
public static final String ASK = "Ask"; //$NON-NLS-1$
|
||||
|
||||
public static final String ASK_ORIG_URL = "https://community.talend.com";
|
||||
|
||||
public static final String EXCHANGE = "Exchange"; //$NON-NLS-1$
|
||||
|
||||
public static final String EXCHANGE_ORIG_URL = "http://www.talendforge.org/exchange/index.php";
|
||||
|
||||
public static final String VIDEOS = "Videos"; //$NON-NLS-1$
|
||||
|
||||
public static final String VIDEOS_ORIG_URL = "https://www.talendforge.org/tutorials";
|
||||
|
||||
public static final String CLOUD = "Cloud"; //$NON-NLS-1$
|
||||
|
||||
public static final String CLOUD_ORIG_URL = "https://iam.integrationcloud.talend.com/idp/trial-registration?utm_medium=studio&utm_source=toolbar&utm_campaign=dynamic_acronym";
|
||||
|
||||
|
||||
/**
|
||||
* The action used to render this delegate.
|
||||
*/
|
||||
private IAction fAction;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate2#getMenu(org.eclipse.swt.widgets.Menu)
|
||||
*/
|
||||
@Override
|
||||
public Menu getMenu(Menu parent) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
|
||||
*/
|
||||
@Override
|
||||
public void init(IWorkbenchWindow window) {
|
||||
// TODO Auto-generated method stub
|
||||
this.window = window;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
@Override
|
||||
public void init(IAction action) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
|
||||
* org.eclipse.swt.widgets.Event)
|
||||
*/
|
||||
@Override
|
||||
public void runWithEvent(IAction action, Event event) {
|
||||
if (fMenu == null && action instanceof WWinPluginPulldown) {
|
||||
IMenuCreator menuProxy = ((WWinPluginPulldown) action).getMenuCreator();
|
||||
ToolItem item = (ToolItem) event.widget;
|
||||
menuProxy.getMenu(item.getParent());
|
||||
}
|
||||
fMenu.setVisible(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
|
||||
* org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
|
||||
}
|
||||
|
||||
private boolean containsType(Object[] objects, ERepositoryObjectType type) {
|
||||
boolean flag = false;
|
||||
for (Object object : objects) {
|
||||
IRepositoryNode node = (IRepositoryNode) object;
|
||||
if (node.getContentType() != null && node.getContentType().equals(type)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
if (node.getContentType() != null && node.hasChildren()) {
|
||||
flag = containsType(node.getChildren().toArray(), type);
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected void fillMenu(Menu menu) {
|
||||
|
||||
IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
|
||||
if (repositoryView == null) {
|
||||
return;
|
||||
}
|
||||
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/demo.png", LEARN_ORIG_URL, LEARN,
|
||||
Messages.getString("LinksToolbarItem_Learn")), -1);
|
||||
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/irc_protocol.png", ASK_ORIG_URL, ASK,
|
||||
Messages.getString("LinksToolbarItem_7")), -1);
|
||||
if (PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange()) {
|
||||
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/exchange_view.png", EXCHANGE_ORIG_URL, EXCHANGE,
|
||||
Messages.getString("LinksToolbarItem_exchange")), -1);
|
||||
}
|
||||
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/videos_icon16x16.png", VIDEOS_ORIG_URL, VIDEOS,
|
||||
Messages.getString("LinksToolbarItem_videos")), -1);
|
||||
if (!PluginChecker.isTIS()) {
|
||||
addToMenu(menu, new ResourceImageTextAction(this.window, "/icons/cloud.png", CLOUD_ORIG_URL, CLOUD,
|
||||
Messages.getString("LinksToolbarItem_cloud")), -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a separator to the given menu.
|
||||
*
|
||||
* @param menu
|
||||
*/
|
||||
protected void addSeparator(Menu menu) {
|
||||
new MenuItem(menu, SWT.SEPARATOR);
|
||||
}
|
||||
|
||||
protected void addToMenu(Menu menu, IAction action, int accelerator) {
|
||||
StringBuffer label = new StringBuffer();
|
||||
if (accelerator >= 0 && accelerator < 10) {
|
||||
// add the numerical accelerator
|
||||
label.append('&');
|
||||
label.append(accelerator);
|
||||
label.append(' ');
|
||||
}
|
||||
label.append(action.getText());
|
||||
action.setText(label.toString());
|
||||
ActionContributionItem item = new ActionContributionItem(action);
|
||||
item.fill(menu, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menu getMenu(Control parent) {
|
||||
setMenu(new Menu(parent));
|
||||
fillMenu(fMenu);
|
||||
initMenu();
|
||||
return fMenu;
|
||||
}
|
||||
|
||||
private void setMenu(Menu menu) {
|
||||
if (fMenu != null) {
|
||||
fMenu.dispose();
|
||||
}
|
||||
fMenu = menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the menu for the action.
|
||||
*/
|
||||
private void initMenu() {
|
||||
// Add listener to re-populate the menu each time
|
||||
// it is shown because of dynamic history list
|
||||
fMenu.addMenuListener(new MenuAdapter() {
|
||||
|
||||
@Override
|
||||
public void menuShown(MenuEvent e) {
|
||||
if (fRecreateMenu) {
|
||||
Menu m = (Menu) e.widget;
|
||||
MenuItem[] items = m.getItems();
|
||||
for (MenuItem item : items) {
|
||||
item.dispose();
|
||||
}
|
||||
fillMenu(m);
|
||||
fRecreateMenu = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.talend.rcp.action.toolbar;
|
||||
|
||||
import org.apache.commons.codec.binary.StringUtils;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.swt.program.Program;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.service.IExchangeService;
|
||||
import org.talend.core.service.ITutorialsService;
|
||||
|
||||
public class ResourceImageTextAction extends Action {
|
||||
|
||||
private IWorkbenchWindow window;
|
||||
|
||||
private String url;
|
||||
|
||||
public ResourceImageTextAction(IWorkbenchWindow window, String imagePath, String url, String text, String tipText) {
|
||||
this.window = window;
|
||||
this.url = url;
|
||||
ImageRegistry imageRegistry = JFaceResources.getImageRegistry();
|
||||
if (imageRegistry.get(imagePath) == null) {
|
||||
ImageDescriptor imageDescriptor = ImageDescriptor.createFromFile(ResourceImageTextAction.class, imagePath);;
|
||||
if (imageDescriptor != null) {
|
||||
imageRegistry.put(imagePath, imageDescriptor);
|
||||
}
|
||||
}
|
||||
setImageDescriptor(imageRegistry.getDescriptor(imagePath));
|
||||
setToolTipText(tipText);
|
||||
setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (window != null) {
|
||||
|
||||
if (StringUtils.equals(CreatResourcesToolbarAction.EXCHANGE_ORIG_URL, url)) {
|
||||
IExchangeService service = GlobalServiceRegister.getDefault().getService(IExchangeService.class);
|
||||
service.openExchangeEditor();
|
||||
} else if (StringUtils.equals(CreatResourcesToolbarAction.VIDEOS_ORIG_URL, url)) {
|
||||
ITutorialsService service = GlobalServiceRegister.getDefault().getService(ITutorialsService.class);
|
||||
service.openTutorialsDialog();
|
||||
} else {
|
||||
openBrower(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void openBrower(String url) {
|
||||
Program.launch(url);
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,6 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.utils.TalendPropertiesUtil;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.ui.branding.IActionBarHelper;
|
||||
@@ -50,7 +49,6 @@ import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.perspective.PerspectiveMenuManager;
|
||||
import org.talend.core.ui.services.IOpenJobScriptActionService;
|
||||
import org.talend.rcp.i18n.Messages;
|
||||
import org.talend.rcp.intro.linksbar.LinkToolbarLabel;
|
||||
import org.talend.rcp.intro.linksbar.LinksToolbarItem;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.ui.actions.toolbar.ProjectSettingsAction;
|
||||
@@ -250,30 +248,7 @@ public class ActionBarBuildHelper implements IActionBarHelper {
|
||||
public void fillCoolBar(ICoolBarManager coolBar) {
|
||||
IToolBarManager toolBar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
|
||||
coolBar.add(new ToolBarContributionItem(toolBar, Messages.getString("ApplicationActionBarAdvisor.save"))); //$NON-NLS-1$
|
||||
toolBar.add(ActionFactory.SAVE.create(window));
|
||||
|
||||
IToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
|
||||
toolBarManager.add(new ImageAction(this.window, "icons/demo.png", LinksToolbarItem.LEARN_ORIG_URL,
|
||||
Messages.getString("LinksToolbarItem_Learn")));
|
||||
toolBarManager.add(new LinkToolbarLabel(LinksToolbarItem.LEARN_URL, Messages.getString("LinksToolbarItem_Learn")));
|
||||
toolBarManager.add(new ImageAction(this.window, "icons/irc_protocol.png", LinksToolbarItem.ASK_ORIG_URL,
|
||||
Messages.getString("LinksToolbarItem_7")));
|
||||
toolBarManager.add(new LinkToolbarLabel(LinksToolbarItem.ASK_URL, Messages.getString("LinksToolbarItem_7")));
|
||||
if (PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange()) {
|
||||
toolBarManager.add(new ImageAction(this.window, "icons/exchange_view.png", LinksToolbarItem.EXCHANGE_ORIG_URL,
|
||||
Messages.getString("LinksToolbarItem_exchange")));
|
||||
toolBarManager
|
||||
.add(new LinkToolbarLabel(LinksToolbarItem.EXCHANGE_URL, Messages.getString("LinksToolbarItem_exchange")));
|
||||
}
|
||||
toolBarManager.add(new ImageAction(this.window, "icons/videos_icon16x16.png", LinksToolbarItem.VIDEOS_ORIG_URL,
|
||||
Messages.getString("LinksToolbarItem_videos")));
|
||||
toolBarManager.add(new LinkToolbarLabel(LinksToolbarItem.VIDEOS_URL, Messages.getString("LinksToolbarItem_videos")));
|
||||
if (!PluginChecker.isTIS()) {
|
||||
toolBarManager.add(new ImageAction(this.window, "icons/cloud.png", LinksToolbarItem.CLOUD_ORIG_URL,
|
||||
Messages.getString("LinksToolbarItem_cloud")));
|
||||
toolBarManager.add(new LinkToolbarLabel(LinksToolbarItem.CLOUD_URL, Messages.getString("LinksToolbarItem_cloud")));
|
||||
}
|
||||
coolBar.add(new ToolBarContributionItem(toolBarManager, LinksToolbarItem.COOLITEM_LINKS_ID));
|
||||
toolBar.add(ActionFactory.SAVE.create(window));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.rcp.intro;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.program.Program;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.service.IExchangeService;
|
||||
import org.talend.core.service.ITutorialsService;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.rcp.Activator;
|
||||
import org.talend.rcp.intro.linksbar.LinksToolbarItem;
|
||||
|
||||
public class ImageAction extends Action {
|
||||
|
||||
private final IWorkbenchWindow window;
|
||||
|
||||
private String url;
|
||||
|
||||
public ImageAction(IWorkbenchWindow window, String imagePath, String url, String tipText) {
|
||||
this.window = window;
|
||||
this.url = url;
|
||||
ImageDescriptor imageDescriptorFromPlugin = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, imagePath);
|
||||
setImageDescriptor(imageDescriptorFromPlugin);
|
||||
setToolTipText(tipText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (window != null) {
|
||||
if (StringUtils.equals(LinksToolbarItem.EXCHANGE_ORIG_URL, url)) {
|
||||
IExchangeService service = GlobalServiceRegister.getDefault().getService(IExchangeService.class);
|
||||
service.openExchangeEditor();
|
||||
} else if (StringUtils.equals(LinksToolbarItem.VIDEOS_ORIG_URL, url)) {
|
||||
ITutorialsService service = GlobalServiceRegister.getDefault().getService(ITutorialsService.class);
|
||||
service.openTutorialsDialog();
|
||||
} else {
|
||||
if (!PluginChecker.isTIS() && StringUtils.equals(LinksToolbarItem.CLOUD_ORIG_URL, url)
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
IBrandingService brandingService = GlobalServiceRegister.getDefault().getService(IBrandingService.class);
|
||||
String edition = brandingService.getAcronym();
|
||||
this.url = this.url.replace("dynamic_acronym", edition);//$NON-NLS-1$
|
||||
}
|
||||
openBrower(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void openBrower(String url) {
|
||||
Program.launch(url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user