use of org.eclipse.jface.action.ToolBarManager in project rap by entirej.
the class EJRWTPieChartRecordBlockRenderer method buildGuiComponent.
@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
EJFrameworkExtensionProperties appProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
if (appProp != null) {
EJFrameworkExtensionProperties propertyGroup = appProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
if (propertyGroup != null) {
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY);
}
}
EJBlockProperties blockProperties = _block.getProperties();
EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = mainScreenProperties.getWidth();
gridData.heightHint = mainScreenProperties.getHeight();
gridData.horizontalSpan = mainScreenProperties.getHorizontalSpan();
gridData.verticalSpan = mainScreenProperties.getVerticalSpan();
gridData.grabExcessHorizontalSpace = mainScreenProperties.canExpandHorizontally();
gridData.grabExcessVerticalSpace = mainScreenProperties.canExpandVertically();
if (gridData.grabExcessHorizontalSpace) {
gridData.minimumWidth = mainScreenProperties.getWidth();
}
if (gridData.grabExcessVerticalSpace) {
gridData.minimumHeight = mainScreenProperties.getHeight();
}
_rendererProp = blockProperties.getBlockRendererProperties();
blockCanvas.setLayoutData(gridData);
EJFrameworkExtensionProperties sectionProperties = null;
if (_rendererProp != null) {
sectionProperties = _rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
}
if (sectionProperties != null && sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
int style = ExpandableComposite.TITLE_BAR;
String mode = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
style = style | ExpandableComposite.TWISTIE;
} else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
style = style | ExpandableComposite.TREE_NODE;
}
if (sectionProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
style = style | ExpandableComposite.EXPANDED;
}
Section section = toolkit.createSection(blockCanvas, style);
section.setLayoutData(gridData);
String title = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
if (title != null) {
section.setText(title);
}
EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
String frameTitle = mainScreenProperties.getFrameTitle();
if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(section, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
group.setLayout(new FillLayout());
group.setLayoutData(gridData);
hookKeyListener(group);
group.setText(frameTitle);
_mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
section.setClient(group);
} else {
_mainPane = new EJRWTEntireJGridPane(section, 1);
_mainPane.setLayoutData(gridData);
_mainPane.cleanLayoutHorizontal();
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
section.setClient(_mainPane);
}
final EJFrameworkExtensionPropertyList propertyList = sectionProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
final ToolBar toolbar = toolBarManager.createControl(section);
final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
toolbar.setCursor(handCursor);
// Cursor needs to be explicitly disposed
toolbar.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (handCursor != null && handCursor.isDisposed() == false) {
handCursor.dispose();
}
}
});
List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
if (actionID != null) {
Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {
@Override
public void runWithEvent(Event event) {
_block.executeActionCommand(actionID, EJScreenType.MAIN);
}
};
if (actionName != null) {
action.setText(actionName);
}
if (actionTooltip != null) {
action.setDescription(actionTooltip);
}
if (actionImage != null && actionImage.length() > 0) {
action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
}
toolBarManager.add(action);
}
}
toolBarManager.update(true);
section.setTextClient(toolbar);
}
} else {
String frameTitle = mainScreenProperties.getFrameTitle();
if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(blockCanvas, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
group.setLayout(new FillLayout());
group.setLayoutData(gridData);
hookKeyListener(group);
group.setText(frameTitle);
_mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
} else {
_mainPane = new EJRWTEntireJGridPane(blockCanvas, 1);
_mainPane.setLayoutData(gridData);
_mainPane.cleanLayout();
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
}
}
hookKeyListener(_mainPane);
int style = SWT.NONE;
Collection<EJItemGroupProperties> allItemGroupProperties = _block.getProperties().getScreenItemGroupContainer(EJScreenType.MAIN).getAllItemGroupProperties();
{
_chartView = null;
if (allItemGroupProperties.size() > 0) {
EJItemGroupProperties displayProperties = allItemGroupProperties.iterator().next();
if (displayProperties.dispayGroupFrame() && displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0) {
Group group = new Group(_mainPane, SWT.NONE);
group.setLayout(new FillLayout());
group.setText(displayProperties.getFrameTitle());
group.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
_chartView = new PieChart(group, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
} else {
_chartView = new PieChart(_mainPane, displayProperties.dispayGroupFrame() ? style | SWT.BORDER : style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
_chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
}
} else {
_chartView = new PieChart(_mainPane, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
_chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
}
}
_chartView.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent arg0) {
setHasFocus(false);
}
@Override
public void focusGained(FocusEvent arg0) {
setHasFocus(true);
}
});
_mainPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent arg0) {
if (!_chartView.isFocusControl()) {
setHasFocus(true);
}
}
});
_chartView.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent arg0) {
if (!_chartView.isFocusControl()) {
setHasFocus(true);
}
}
});
for (EJItemGroupProperties groupProperties : allItemGroupProperties) {
Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
for (EJScreenItemProperties screenItemProperties : itemProperties) {
EJCoreMainScreenItemProperties mainScreenItemProperties = (EJCoreMainScreenItemProperties) screenItemProperties;
String visualAttribute = mainScreenItemProperties.getBlockRendererRequiredProperties().getStringProperty(VISUAL_ATTRIBUTE_PROPERTY);
EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, mainScreenItemProperties.getReferencedItemName());
EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) item.getManagedItemRenderer().getUnmanagedRenderer();
if (visualAttribute != null) {
EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
if (va != null) {
itemRenderer.setInitialVisualAttribute(va);
}
}
if (item.getProperties().getVisualAttributeProperties() != null) {
itemRenderer.setVisualAttribute(item.getProperties().getVisualAttributeProperties());
}
}
}
refresh();
}
use of org.eclipse.jface.action.ToolBarManager in project egit by eclipse.
the class StagingView method createStagedToolBarComposite.
private void createStagedToolBarComposite() {
Composite stagedToolbarComposite = toolkit.createComposite(stagedSection);
stagedToolbarComposite.setBackground(null);
stagedToolbarComposite.setLayout(createRowLayoutWithoutMargin());
stagedSection.setTextClient(stagedToolbarComposite);
stagedExpandAllAction = new Action(UIText.UIUtils_ExpandAll, IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
stagedViewer.expandAll();
enableAutoExpand(stagedViewer);
}
};
stagedExpandAllAction.setImageDescriptor(UIIcons.EXPAND_ALL);
stagedExpandAllAction.setId(EXPAND_ALL_ITEM_TOOLBAR_ID);
stagedCollapseAllAction = new Action(UIText.UIUtils_CollapseAll, IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
stagedViewer.collapseAll();
disableAutoExpand(stagedViewer);
}
};
stagedCollapseAllAction.setImageDescriptor(UIIcons.COLLAPSEALL);
stagedCollapseAllAction.setId(COLLAPSE_ALL_ITEM_TOOLBAR_ID);
stagedToolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
stagedToolBarManager.add(unstageAction);
stagedToolBarManager.add(unstageAllAction);
stagedToolBarManager.add(stagedExpandAllAction);
stagedToolBarManager.add(stagedCollapseAllAction);
stagedToolBarManager.update(true);
stagedToolBarManager.createControl(stagedToolbarComposite);
}
use of org.eclipse.jface.action.ToolBarManager in project egit by eclipse.
the class StagingView method setExpandCollapseActionsVisible.
private void setExpandCollapseActionsVisible(boolean staged, boolean visibleExpandAll, boolean visibleCollapseAll) {
ToolBarManager toolBarManager = staged ? stagedToolBarManager : unstagedToolBarManager;
for (IContributionItem item : toolBarManager.getItems()) {
String id = item.getId();
if (EXPAND_ALL_ITEM_TOOLBAR_ID.equals(id)) {
item.setVisible(visibleExpandAll);
} else if (COLLAPSE_ALL_ITEM_TOOLBAR_ID.equals(id)) {
item.setVisible(visibleCollapseAll);
}
}
(staged ? stagedExpandAllAction : unstagedExpandAllAction).setEnabled(visibleExpandAll);
(staged ? stagedCollapseAllAction : unstagedCollapseAllAction).setEnabled(visibleCollapseAll);
toolBarManager.update(true);
}
use of org.eclipse.jface.action.ToolBarManager in project egit by eclipse.
the class CommitEditor method createHeaderContents.
/**
* @see org.eclipse.ui.forms.editor.SharedHeaderFormEditor#createHeaderContents(org.eclipse.ui.forms.IManagedForm)
*/
@Override
protected void createHeaderContents(IManagedForm headerForm) {
headerForm.addPart(new FocusManagerFormPart(headerFocusTracker) {
@Override
public void setDefaultFocus() {
headerForm.getForm().getForm().setFocus();
}
});
RepositoryCommit commit = getCommit();
ScrolledForm form = headerForm.getForm();
String commitName = commit.getRevCommit().name();
String title = getFormattedHeaderTitle(commitName);
HeaderText text = new HeaderText(form.getForm(), title, commitName);
Control textControl = text.getControl();
if (textControl != null) {
headerFocusTracker.addToFocusTracking(textControl);
}
form.setToolTipText(commitName);
getToolkit().decorateFormHeading(form.getForm());
toolbar = form.getToolBarManager();
ControlContribution repositoryLabelControl = new ControlContribution(// $NON-NLS-1$
"repositoryLabel") {
@Override
protected Control createControl(Composite parent) {
FormToolkit toolkit = getHeaderForm().getToolkit();
String label = getCommit().getRepositoryName();
ImageHyperlink link = new ImageHyperlink(parent, SWT.NONE);
// Focus tracking on this link doesn't really work. It's a
// focusable control inside another focusable control (the
// toolbar). When focus leaves this control through tabbing
// or deactivating the editor, the toolbar gets the focus (and
// possibly loses it right away again). Thus the focus tracker
// will always see the toolbar as the last focused control.
// Unfortunately there is no other way to get some text onto
// the first line of a FormHeading.
headerFocusTracker.addToFocusTracking(link);
link.setText(label);
link.setFont(JFaceResources.getBannerFont());
link.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
link.setToolTipText(UIText.CommitEditor_showGitRepo);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent event) {
RepositoriesView view;
try {
view = (RepositoriesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(RepositoriesView.VIEW_ID);
view.showRepository(getCommit().getRepository());
} catch (PartInitException e) {
Activator.handleError(UIText.CommitEditor_couldNotShowRepository, e, false);
}
}
});
return link;
}
};
toolbar.add(repositoryLabelControl);
CommonUtils.getService(getSite(), IPartService.class).addPartListener(activationListener);
if (commit.isStash()) {
toolbar.add(createActionContributionItem(StashApplyHandler.ID, UIText.CommitEditor_toolbarApplyStash, UIIcons.STASH_APPLY));
toolbar.add(createActionContributionItem(StashDropHandler.ID, UIText.CommitEditor_toolbarDeleteStash, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)));
} else {
toolbar.add(createActionContributionItem(CreateTagHandler.ID, UIText.CommitEditor_toolbarCreateTag, UIIcons.TAG));
toolbar.add(createActionContributionItem(CreateBranchHandler.ID, UIText.CommitEditor_toolbarCreateBranch, UIIcons.BRANCH));
toolbar.add(createActionContributionItem(CheckoutHandler.ID, UIText.CommitEditor_toolbarCheckOut, UIIcons.CHECKOUT));
toolbar.add(createActionContributionItem(CherryPickHandler.ID, UIText.CommitEditor_toolbarCherryPick, UIIcons.CHERRY_PICK));
toolbar.add(createActionContributionItem(RevertHandler.ID, UIText.CommitEditor_toolbarRevert, UIIcons.REVERT));
toolbar.add(createActionContributionItem(ShowInHistoryHandler.ID, UIText.CommitEditor_toolbarShowInHistory, UIIcons.HISTORY));
}
addContributions(toolbar);
toolbar.update(true);
getSite().setSelectionProvider(new ISelectionProvider() {
@Override
public void setSelection(ISelection selection) {
// Ignored
}
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
// Ignored
}
@Override
public ISelection getSelection() {
return new StructuredSelection(getCommit());
}
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
// Ignored
}
});
if (toolbar instanceof ToolBarManager) {
Control control = ((ToolBarManager) toolbar).getControl();
if (control != null) {
headerFocusTracker.addToFocusTracking(control);
}
}
}
use of org.eclipse.jface.action.ToolBarManager in project webtools.servertools by eclipse.
the class NewManualServerComposite method createControl.
/**
* Returns this page's initial visual components.
*/
protected void createControl() {
// top level group
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
layout.marginWidth = 0;
layout.marginHeight = 0;
setLayout(layout);
this.setFont(getParent().getFont());
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD);
List<ServerCreationWizardPageExtension> pageExtensionLst = ServerUIPlugin.getServerCreationWizardPageExtensions();
// Add the page modifier top section UI.
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.TOP, this);
curPageExtension.setUIControlListener(this);
}
serverTypeComposite = new ServerTypeComposite(this, moduleType, serverTypeId, new ServerTypeComposite.ServerTypeSelectionListener() {
public void serverTypeSelected(IServerType type2) {
handleTypeSelection(type2);
// WizardUtil.defaultSelect(parent, CreateServerWizardPage.this);
}
});
serverTypeComposite.setIncludeIncompatibleVersions(includeIncompatible);
GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
data.horizontalSpan = 3;
data.minimumHeight = 150;
serverTypeComposite.setLayoutData(data);
whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE);
// Add the page modifier middle section UI.
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.MIDDLE, this);
}
hostnameListener = new IHostnameSelectionListener() {
public void hostnameSelected(String selectedHostname) {
setHost(selectedHostname);
}
};
hostnameLabel = new Label(this, SWT.NONE);
hostnameLabel.setText(Messages.hostname);
hostname = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL);
hostname.setText(HostnameComposite.LOCALHOST);
hostnameDecoration = new ControlDecoration(hostname, SWT.TOP | SWT.LEAD);
GridData data2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
hostname.setLayoutData(data2);
new Label(this, SWT.NONE);
hostname.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
setHostnameChangeTimer(hostname.getText());
}
});
FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
hostnameDecoration.setImage(fd.getImage());
hostnameDecoration.setDescriptionText(fd.getDescription());
hostname.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
hostnameDecoration.show();
}
public void focusLost(FocusEvent e) {
hostnameDecoration.hide();
}
});
List<String> hosts = ServerUIPlugin.getPreferences().getHostnames();
String[] hosts2 = hosts.toArray(new String[hosts.size()]);
new AutoCompleteField(hostname, new TextContentAdapter(), hosts2);
serverNameLabel = new Label(this, SWT.NONE);
serverNameLabel.setText(Messages.serverName);
serverName = new Text(this, SWT.SINGLE | SWT.BORDER | SWT.CANCEL);
data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
if ((serverName.getStyle() & SWT.CANCEL) != 0)
data.horizontalSpan = 2;
serverName.setLayoutData(data);
if (server != null)
serverName.setText(server.getName());
serverName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (updatingServerName)
return;
String name = serverName.getText();
IServerType selectedServerType = serverTypeComposite.getSelectedServerType();
if (!validate(selectedServerType)) {
// Do not set the server name if it is invalid
return;
}
if (server != null) {
server.setName(name);
String base = serverName.getText().trim();
if (ServerPlugin.isIdInUse(server, base)) {
server.setAttribute("id", generateUniqueId(base));
}
IRuntime runtime2 = server.getRuntime();
if (runtime2 != null && runtime2 instanceof IRuntimeWorkingCopy) {
IRuntimeWorkingCopy rwc = (IRuntimeWorkingCopy) runtime2;
rwc.setName(name);
}
}
if (serverNameModified)
return;
serverNameModified = true;
if (serverNameToolBar != null)
serverNameToolBar.getControl().setVisible(true);
}
});
if ((serverName.getStyle() & SWT.CANCEL) == 0) {
serverNameToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
serverNameToolBar.createControl(this);
IAction resetDefaultAction = new // $NON-NLS-1$
Action(// $NON-NLS-1$
"", // $NON-NLS-1$
IAction.AS_PUSH_BUTTON) {
public void run() {
((ServerWorkingCopy) server).setDefaults(null);
serverName.setText(server.getName());
serverNameModified = false;
if (serverNameToolBar != null)
serverNameToolBar.getControl().setVisible(false);
}
};
resetDefaultAction.setToolTipText(Messages.serverNameDefault);
resetDefaultAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_RESET_DEFAULT));
resetDefaultAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_RESET_DEFAULT));
serverNameToolBar.add(resetDefaultAction);
serverNameToolBar.update(false);
serverNameToolBar.getControl().setVisible(false);
}
runtimeLabel = new Label(this, SWT.NONE);
runtimeLabel.setText(Messages.wizNewServerRuntime);
runtimeCombo = new Combo(this, SWT.READ_ONLY);
runtimeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
runtimeCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
try {
setRuntime(runtimes[runtimeCombo.getSelectionIndex()]);
} catch (Exception ex) {
// ignore
}
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
addRuntime = new Link(this, SWT.NONE);
addRuntime.setText("<a>" + Messages.addRuntime + "</a>");
addRuntime.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
addRuntime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IServerType serverType = serverTypeComposite.getSelectedServerType();
showRuntimeWizard(serverType);
}
});
configureRuntimes = new Link(this, SWT.NONE);
configureRuntimes.setText("<a>" + Messages.configureRuntimes + "</a>");
data = new GridData(GridData.HORIZONTAL_ALIGN_END);
data.horizontalSpan = 3;
configureRuntimes.setLayoutData(data);
configureRuntimes.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (showPreferencePage()) {
runtime = null;
IServerType serverType = serverTypeComposite.getSelectedServerType();
updateRuntimeCombo(serverType);
}
}
});
// Add the page modifier bottom section UI.
for (ServerCreationWizardPageExtension curPageExtension : pageExtensionLst) {
curPageExtension.createControl(ServerCreationWizardPageExtension.UI_POSITION.BOTTOM, this);
}
Dialog.applyDialogFont(this);
}
Aggregations