use of com.centurylink.mdw.plugin.actions.MdwMenuManager in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestView method createPartControl.
@Override
public void createPartControl(Composite parent) {
GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
parent.setLayout(gridLayout);
counterComposite = createProgressCountPanel(parent);
counterComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
SashForm sashForm = createSashForm(parent);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
// action group
actionGroup = new AutomatedTestActionGroup(this);
IActionBars actionBars = getViewSite().getActionBars();
actionGroup.fillActionBars(actionBars);
// context menu
MenuManager menuMgr = new MdwMenuManager("Automated Test");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this);
contextMenu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(contextMenu);
getSite().registerContextMenu(menuMgr, treeViewer);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, MdwPlugin.getPluginId() + ".toolbox_help");
}
use of com.centurylink.mdw.plugin.actions.MdwMenuManager in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerView method createPartControl.
@Override
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent) {
protected void handleTreeExpand(TreeEvent event) {
if (event.item.getData() instanceof WorkflowProject) {
final WorkflowProject project = (WorkflowProject) event.item.getData();
if (project.isFilePersist() && !project.isRemote()) {
// authentication not needed
project.setUser(new User(System.getProperty("user.name")));
} else {
// user authentication
Boolean authenticated = project.isAuthenticated();
if (authenticated == null) {
// has to be in a separate
// thread to take effect
event.item.getDisplay().asyncExec(new Runnable() {
public void run() {
treeViewer.collapseToLevel(project, TreeViewer.ALL_LEVELS);
}
});
return;
}
if (!authenticated) {
LoginDialog loginDialog = new LoginDialog(MdwPlugin.getShell(), project);
int res = loginDialog.open();
if (res == Dialog.CANCEL || !project.isAuthenticated()) {
// has
// to
// be
// in
// a
// separate
// thread
// to
// take
// effect
event.item.getDisplay().asyncExec(new Runnable() {
public void run() {
treeViewer.collapseToLevel(project, TreeViewer.ALL_LEVELS);
}
});
return;
}
}
super.handleTreeExpand(event);
return;
}
}
super.handleTreeExpand(event);
}
};
ProcessExplorerContentProvider contentProvider = new ProcessExplorerContentProvider();
// for
WorkflowProjectManager.getInstance().addElementChangeListener(contentProvider);
// project
// adds/deletes
treeViewer.setContentProvider(contentProvider);
treeViewer.setLabelProvider(new ProcessExplorerLabelProvider());
treeViewer.setInput(WorkflowProjectManager.getInstance().getWorkflowProjects());
treeViewer.collapseAll();
clipboard = new Clipboard(parent.getDisplay());
// action group
actionGroup = new ProcessExplorerActionGroup(this);
actionGroup.fillActionBars(getViewSite().getActionBars());
// context menu
MenuManager menuMgr = new MdwMenuManager("Process Explorer");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this);
contextMenu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(contextMenu);
getSite().registerContextMenu(menuMgr, treeViewer);
treeViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
for (Object item : getSelection().toList()) {
if (!actionGroup.getActionHandler().open((WorkflowElement) item))
expand(item);
}
}
});
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
handleSelectionChanged((IStructuredSelection) event.getSelection());
}
});
// drag and drop support
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
dragSource = new ProcessExplorerDragSource(treeViewer);
treeViewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, transfers, dragSource);
dropTarget = new ProcessExplorerDropTarget(treeViewer);
treeViewer.addDropSupport(DND.DROP_MOVE | DND.DROP_COPY, transfers, dropTarget);
contextListener = new ProcessExplorerContextListener();
getSite().getPage().addPartListener(contextListener);
MdwPlugin.getPluginWorkbench().getHelpSystem().setHelp(parent, MdwPlugin.getPluginId() + ".process_explorer_help");
}
Aggregations