use of org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor in project tdi-studio-se by Talend.
the class JobSettingsView method createPartControl.
@Override
public void createPartControl(Composite parent) {
// tabFactory = new HorizontalTabFactory();
this.parent = parent;
tabFactory.initComposite(parent, false);
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null) {
if ((!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getData() != descriptor.getData() || currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
}
if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
Object data = descriptor.getData();
if (data instanceof Element) {
element = (Element) data;
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), element, descriptor.getCategory());
} else if (data instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) data;
IProcess process = getProcess(viewObject);
if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
data = process;
}
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), data, descriptor.getCategory());
} else if (data instanceof IEditorPart) {
currentSelectedTab = descriptor;
IRepositoryViewObject repObj = retrieveBusiness((IEditorPart) data);
if (repObj != null) {
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), repObj, descriptor.getCategory());
}
} else {
currentSelectedTab = descriptor;
IDynamicProperty propertyComposite = createTabComposite(tabFactory.getTabComposite(), null, descriptor.getCategory());
}
selectedPrimary = false;
}
}
});
}
use of org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor in project tdi-studio-se by Talend.
the class JobSettingsView method setElement.
/**
*
* DOC ggu Comment method "setElement".
*
* @param obj
*/
private void setElement(Object obj, final String title, Image image) {
EComponentCategory[] categories = null;
if (obj != null && obj instanceof Process) {
process = (Process) obj;
if (currentSelectedTab != null && currentSelectedTab.getData().equals(process) && !cleaned) {
return;
}
categories = getCategories(process);
} else if (obj != null && obj instanceof IRepositoryViewObject) {
categories = getCategories(obj);
IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
IProcess process = getProcess(viewObject);
if (process != null && process instanceof Element && process.getId().equals(viewObject.getId()) && process.getVersion().equals(viewObject.getVersion())) {
categories = getCategories(process);
}
} else if (obj instanceof IEditorPart) {
if (CorePlugin.getDefault().getDiagramModelService().isBusinessDiagramEditor((IEditorPart) obj)) {
categories = getCategories(obj);
}
} else {
BusinessType type = CorePlugin.getDefault().getDiagramModelService().getBusinessModelType(obj);
if (BusinessType.NOTE.equals(type) || BusinessType.SHAP.equals(type) || BusinessType.CONNECTION.equals(type)) {
categories = getCategories(obj);
} else {
cleanDisplay();
return;
}
}
final List<TalendPropertyTabDescriptor> descriptors = new ArrayList<TalendPropertyTabDescriptor>();
for (EComponentCategory category : categories) {
TalendPropertyTabDescriptor d = new TalendPropertyTabDescriptor(category);
d.setData(obj);
descriptors.add(d);
}
tabFactory.setInput(descriptors);
setPartName(title, image);
cleaned = false;
tabFactory.setSelection(new IStructuredSelection() {
@Override
public Object getFirstElement() {
return null;
}
@Override
public Iterator iterator() {
return null;
}
@Override
public int size() {
return 0;
}
@Override
public Object[] toArray() {
return null;
}
@Override
public List toList() {
List<TalendPropertyTabDescriptor> d = new ArrayList<TalendPropertyTabDescriptor>();
if (descriptors.size() > 0) {
if (currentSelectedTab != null) {
for (TalendPropertyTabDescriptor ds : descriptors) {
if (ds.getCategory() == currentSelectedTab.getCategory()) {
d.add(ds);
return d;
}
}
}
d.add(descriptors.get(0));
}
return d;
}
@Override
public boolean isEmpty() {
return false;
}
});
}
use of org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor in project tdi-studio-se by Talend.
the class ProcessView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
parent.setLayout(new FillLayout());
sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
sash.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
GridLayout layout = new GridLayout();
sash.setLayout(layout);
Composite left = new Composite(sash, SWT.NONE);
left.setLayout(new FillLayout());
Composite right = new Composite(sash, SWT.NONE);
right.setLayout(new FormLayout());
FormData layouDatag = new FormData();
layouDatag.left = new FormAttachment(0, 0);
layouDatag.width = 32;
layouDatag.top = new FormAttachment(0, 0);
layouDatag.bottom = new FormAttachment(100, 0);
final Composite buttonComposite = new Composite(right, SWT.ERROR);
buttonComposite.setLayoutData(layouDatag);
buttonComposite.setLayout(new GridLayout());
Composite cotextCom = new Composite(right, SWT.NONE);
layouDatag = new FormData();
layouDatag.left = new FormAttachment(0, 32);
layouDatag.right = new FormAttachment(100, 0);
layouDatag.top = new FormAttachment(0, 0);
layouDatag.bottom = new FormAttachment(100, 0);
cotextCom.setLayoutData(layouDatag);
cotextCom.setLayout(new GridLayout());
tabFactory.initComposite(left, false);
moveButton = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveButton.setText(">>");
moveButton.setToolTipText(Messages.getString("ProcessComposite.hideContext"));
final GridData layoutData = new GridData();
layoutData.verticalAlignment = GridData.CENTER;
layoutData.horizontalAlignment = GridData.CENTER;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
moveButton.setLayoutData(layoutData);
addListeners();
sash.setSashWidth(5);
sash.setWeights(new int[] { 18, 5 });
contextComposite = new ProcessContextComposite(cotextCom, SWT.NONE);
contextComposite.setBackground(right.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// processComposite = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL |
// SWT.NO_FOCUS);
// dc = processComposite;
// createBasicComposite(tabFactory.getTabComposite(), element, null);
tabFactory.getTabComposite().layout();
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null && (currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
if (currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
currentSelectedTab = descriptor;
selectedPrimary = false;
createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
}
}
});
setElement();
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
IHandler handler1;
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (brandingService.getBrandingConfiguration().isAllowDebugMode()) {
Action debugAction = new DebugAction();
handler1 = new ActionHandler(debugAction);
handlerService.activateHandler(debugAction.getActionDefinitionId(), handler1);
}
Action killAction = new KillAction();
handler1 = new ActionHandler(killAction);
handlerService.activateHandler(killAction.getActionDefinitionId(), handler1);
FocusListener fl = new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
//$NON-NLS-1$
log.trace(Messages.getString("ProcessView.gainFocusLog"));
IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
//$NON-NLS-1$
ca = contextService.activateContext("talend.runProcess");
}
@Override
public void focusLost(FocusEvent e) {
//$NON-NLS-1$
log.trace(Messages.getString("ProcessView.lostFocusLog"));
if (ca != null) {
IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
contextService.deactivateContext(ca);
}
}
};
addListenerOnChildren(parent, fl);
rubjobManager.setProcessShell(getSite().getShell());
contextManagerListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (RunProcessContextManager.PROP_ACTIVE.equals(evt.getPropertyName())) {
// rubjobManager.setBooleanTrace(false);
runningProcessChanged();
}
}
};
RunProcessPlugin.getDefault().getRunProcessContextManager().addPropertyChangeListener(contextManagerListener);
runAction = new RunAction();
}
use of org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor in project tdi-studio-se by Talend.
the class ProcessView method selectTab.
public void selectTab(final EComponentCategory category) {
if (tabFactory.getSelection().getCategory().equals(category)) {
return;
}
List<TalendPropertyTabDescriptor> allTabs = tabFactory.getInput();
final List<TalendPropertyTabDescriptor> selection = new ArrayList<TalendPropertyTabDescriptor>();
for (TalendPropertyTabDescriptor talendPropertyTabDescriptor : allTabs) {
if (talendPropertyTabDescriptor.getCategory().equals(category)) {
dc = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
// createBasicComposite(tabFactory.getTabComposite(), element, null);
refresh();
selection.add(talendPropertyTabDescriptor);
}
}
tabFactory.setSelection(new StructuredSelection() {
@Override
public List toList() {
return selection;
}
});
}
use of org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor in project tdi-studio-se by Talend.
the class ComponentSettingsView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
tabFactory.initComposite(parent, true);
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null && (!currentSelectedTab.getData().equals(descriptor.getData()) || currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
if (element == null || !element.equals(descriptor.getData()) || currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
element = (Element) descriptor.getData();
currentSelectedTab = descriptor;
if (descriptor.getData() instanceof ConnectionLabel) {
createDynamicComposite(tabFactory.getTabComposite(), ((ConnectionLabel) descriptor.getData()).getConnection(), descriptor.getCategory());
} else {
createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
}
selectedPrimary = false;
}
}
});
}
Aggregations