use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class ResultSetHandlerToggleMode method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
if (element.getServiceLocator() instanceof IWorkbenchPartSite) {
IWorkbenchPartSite partSite = (IWorkbenchPartSite) element.getServiceLocator();
if (partSite.getPart() instanceof IResultSetContainer) {
IResultSetController rsv = ((IResultSetContainer) partSite.getPart()).getResultSetController();
if (rsv != null) {
if (!rsv.isRecordMode()) {
element.setText("Switch to record mode");
element.setChecked(true);
} else {
element.setText("Switch to grid mode");
element.setChecked(false);
}
}
}
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class ItemListControl method fillCustomActions.
@Override
public void fillCustomActions(IContributionManager contributionManager) {
super.fillCustomActions(contributionManager);
final DBNNode rootNode = getRootNode();
if (rootNode instanceof DBNDatabaseFolder && ((DBNDatabaseFolder) rootNode).getItemsMeta() != null) {
contributionManager.add(new Action(UINavigatorMessages.obj_editor_properties_control_action_filter_setting, DBeaverIcons.getImageDescriptor(UIIcon.FILTER)) {
@Override
public void run() {
NavigatorHandlerFilterConfig.configureFilters(getShell(), rootNode);
}
});
}
addColumnConfigAction(contributionManager);
IWorkbenchSite workbenchSite = getWorkbenchSite();
if (rootNode instanceof DBNDatabaseFolder) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_OPEN));
{
if (ObjectPropertyTester.canCreateObject(rootNode, true)) {
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_CREATE));
} else if (ObjectPropertyTester.canCreateObject(rootNode, false)) {
contributionManager.add(new Action(null, Action.AS_DROP_DOWN_MENU) {
{
setActionDefinitionId(NavigatorCommands.CMD_OBJECT_CREATE);
}
@Override
public void run() {
super.run();
}
@Override
public IMenuCreator getMenuCreator() {
return new MenuCreator(control -> {
List<IContributionItem> items = NavigatorHandlerObjectCreateNew.fillCreateMenuItems((IWorkbenchPartSite) workbenchSite, rootNode);
MenuManager menuManager = new MenuManager();
for (IContributionItem cc : items) {
menuManager.add(cc);
}
return menuManager;
});
}
});
}
}
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_DELETE));
}
if (rootNode instanceof DBNDatabaseNode && rootNode.isPersisted()) {
boolean hasReorder = false;
List<Class<?>> childrenTypes = ((DBNDatabaseNode) rootNode).getChildrenTypes(null);
for (Class<?> chilType : childrenTypes) {
if (DBWorkbench.getPlatform().getEditorsRegistry().getObjectManager(chilType, DBEObjectReorderer.class) != null) {
hasReorder = true;
break;
}
}
if (hasReorder) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_MOVE_UP));
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, NavigatorCommands.CMD_OBJECT_MOVE_DOWN));
}
}
if (rootNode instanceof DBNDatabaseNode) {
// Expand/collapse
final List<DBXTreeNode> inlineMetas = collectInlineMetas((DBNDatabaseNode) rootNode, ((DBNDatabaseNode) rootNode).getMeta());
if (!inlineMetas.isEmpty()) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, IWorkbenchCommandConstants.NAVIGATE_COLLAPSE_ALL, null, UIIcon.TREE_COLLAPSE_ALL));
contributionManager.add(ActionUtils.makeCommandContribution(workbenchSite, IWorkbenchCommandConstants.NAVIGATE_EXPAND_ALL, null, UIIcon.TREE_EXPAND_ALL));
}
}
// Save/revert
if (workbenchSite instanceof MultiPageEditorSite) {
final MultiPageEditorPart editor = ((MultiPageEditorSite) workbenchSite).getMultiPageEditor();
if (editor instanceof EntityEditor) {
contributionManager.add(new Separator());
DatabaseEditorUtils.contributeStandardEditorActions(workbenchSite, contributionManager);
}
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project xtext-xtend by eclipse.
the class OpenEditorAction method run.
@Override
public void run() {
if (inputFile == null) {
return;
}
IWorkbenchPartSite workbenchPartSite = derivedSourceView.getSite();
IWorkbenchPage workbenchPage = workbenchPartSite.getPage();
try {
IEditorPart editorPart = workbenchPage.openEditor(new FileEditorInput(inputFile), COMPILATION_UNIT_EDITOR_ID, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
if (selectedRegion != null) {
((ITextEditor) editorPart).selectAndReveal(selectedRegion.getOffset(), selectedRegion.getLength());
}
} catch (PartInitException partInitException) {
throw new WrappedRuntimeException(partInitException);
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project tmdm-studio-se by Talend.
the class TestTriggerAction method doRun.
@Override
protected void doRun() {
com.amalto.workbench.utils.MDMServerDef serverDef = getServerDef();
if (serverDef == null) {
return;
}
boolean canConnect = checkConnection(serverDef.getUrl(), serverDef.getUser(), serverDef.getPasswd());
if (!canConnect) {
MessageDialog.openError(getShell(), Messages.RoutingRuleMainPage2_CheckConnection, Messages.RoutingRuleMainPage2_UnableToConnect);
return;
}
try {
service = Util.getMDMService(new URL(serverDef.getUrl()), serverDef.getUser(), serverDef.getPasswd());
IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
dialog = new DataClusterDialog(getShell(), new TreeObject(), site);
dialog.setDefaultServerDef(serverDef);
dialog.setOkLabel(Messages.TestTriggerAction_Test);
dialog.setCancelLabel(Messages.TestTriggerAction_Close);
dialog.setSelectionListener(this);
dialog.open();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project tmdm-studio-se by Talend.
the class NewProcessAction method doRun.
@Override
protected void doRun() {
parentItem = null;
selectObj = getSelectedObject().get(0);
int type = getType();
if (selectObj instanceof IRepositoryViewObject) {
Item pItem = ((IRepositoryViewObject) selectObj).getProperty().getItem();
if (pItem instanceof ContainerItem) {
parentItem = (ContainerItem) pItem;
}
}
IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
// wizard
NewProcessWizard newProcessWizard = new NewProcessWizard(site, type);
WizardDialog wizardDialog = new WizardDialog(getShell(), newProcessWizard);
wizardDialog.setPageSize(500, 260);
if (wizardDialog.open() == IDialogConstants.OK_ID) {
WSTransformerV2E newProcess = newProcessWizard.getNewProcess();
final Item item = createServerObject(newProcess);
commonViewer.refresh(selectObj);
commonViewer.expandToLevel(selectObj, 1);
openEditor(item);
if (newProcessWizard.isCreateJob()) {
generateJobTemplate(newProcessWizard.getType(), newProcessWizard.getProcessName(), newProcessWizard.getReturnMessages(), newProcessWizard.isEnableRedirect(), newProcessWizard.getRedirectUrl(), newProcessWizard.getJobTemplates());
refreshJobEditorTitle(item);
}
}
}
Aggregations