use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.
the class ViewerTestDTD method createPartControl.
/**
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
*/
public void createPartControl(Composite parent) {
IContributionManager mgr = getViewSite().getActionBars().getMenuManager();
addActions(mgr);
// create source viewer & its content type-specific viewer
// configuration
fSourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);
fConfig = new StructuredTextViewerConfigurationDTD();
// set up the viewer with a document & viewer config
setupViewerForNew();
setupViewerPreferences();
}
use of org.eclipse.jface.action.IContributionManager in project netxms by netxms.
the class ServerNameStatusLineItem method setServerInfo.
/**
* Sets the text to be displayed in the status line.
*
* @param text the text to be displayed, must not be <code>null</code>
*/
public void setServerInfo(String name, String color) {
serverName = name;
serverColor = (color != null) ? ColorConverter.parseColorDefinition(color) : null;
if (label != null && !label.isDisposed()) {
label.setText(serverName);
setColors();
}
// Always update if using 'CALC_TRUE_WIDTH'
if (!isVisible() || charWidth == CALC_TRUE_WIDTH) {
setVisible(true);
IContributionManager contributionManager = getParent();
if (contributionManager != null) {
contributionManager.update(true);
}
}
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class ObjectPropertiesEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
// Add lazy props listener
// PropertiesContributor.getInstance().addLazyListener(this);
pageControl = new ObjectEditorPageControl(parent, SWT.SHEET, this) {
@Override
public void fillCustomActions(IContributionManager contributionManager) {
createPropertyRefreshAction(contributionManager);
super.fillCustomActions(contributionManager);
if (propertiesPanel != null && folderComposite == null) {
// We have object editor and no folders - contribute default actions
DatabaseEditorUtils.contributeStandardEditorActions(getSite(), contributionManager);
}
}
};
CSSUtils.setCSSClass(pageControl, DBStyles.COLORED_BY_CONNECTION_TYPE);
pageControl.setShowDivider(true);
mainComposite = new Composite(pageControl, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.verticalSpacing = 5;
gl.horizontalSpacing = 0;
gl.marginHeight = 0;
gl.marginWidth = 0;
mainComposite.setLayout(gl);
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageControl.createProgressPanel();
curFolderId = getEditorInput().getDefaultFolderId();
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class ExasolLockEditor method createLockViewer.
@SuppressWarnings("unchecked")
@Override
protected LockManagerViewer createLockViewer(DBCExecutionContext executionContext, Composite parent) {
@SuppressWarnings("rawtypes") DBAServerLockManager<DBAServerLock, DBAServerLockItem> lockManager = (DBAServerLockManager) new ExasolLockManager((ExasolDataSource) executionContext.getDataSource());
return new LockManagerViewer(this, parent, lockManager) {
@Override
protected void contributeToToolbar(DBAServerLockManager<DBAServerLock, DBAServerLockItem> sessionManager, IContributionManager contributionManager) {
contributionManager.add(new Separator());
}
@SuppressWarnings("serial")
@Override
protected void onLockSelect(final DBAServerLock lock) {
super.onLockSelect(lock);
if (lock != null) {
final ExasolLock pLock = (ExasolLock) lock;
super.refreshDetail(new HashMap<String, Object>() {
{
put(sidHold, BigInteger.valueOf(pLock.getHold_sid()));
put(sidWait, BigInteger.valueOf(pLock.getWait_sid().longValue()));
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class OracleSessionEditor method createSessionViewer.
@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer<OracleServerSession>(this, parent, new OracleServerSessionManager((OracleDataSource) executionContext.getDataSource())) {
private boolean showBackground;
private boolean showInactive;
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
contributionManager.add(killSessionAction);
contributionManager.add(disconnectSessionAction);
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeActionContribution(new Action("Show background", Action.AS_CHECK_BOX) {
{
setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
setToolTipText("Show background tasks");
setChecked(showBackground);
}
@Override
public void run() {
showBackground = isChecked();
refreshPart(OracleSessionEditor.this, true);
}
}, true));
contributionManager.add(ActionUtils.makeActionContribution(new Action("Show inactive", Action.AS_CHECK_BOX) {
{
setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
setToolTipText("Show inactive sessions");
setChecked(showInactive);
}
@Override
public void run() {
showInactive = isChecked();
refreshPart(OracleSessionEditor.this, true);
}
}, true));
}
@Override
protected void onSessionSelect(DBAServerSession session) {
super.onSessionSelect(session);
killSessionAction.setEnabled(session != null);
disconnectSessionAction.setEnabled(session != null);
}
@Override
protected void loadSettings(IDialogSettings settings) {
showBackground = CommonUtils.toBoolean(settings.get("showBackground"));
showInactive = CommonUtils.toBoolean(settings.get("showInactive"));
super.loadSettings(settings);
}
@Override
protected void saveSettings(IDialogSettings settings) {
super.saveSettings(settings);
settings.put("showBackground", showBackground);
settings.put("showInactive", showInactive);
}
@Override
public Map<String, Object> getSessionOptions() {
Map<String, Object> options = new HashMap<>();
if (showBackground) {
options.put(OracleServerSessionManager.OPTION_SHOW_BACKGROUND, true);
}
if (showInactive) {
options.put(OracleServerSessionManager.OPTION_SHOW_INACTIVE, true);
}
return options;
}
};
}
Aggregations