Why is a disabled SWT link not grayed out? - eclipse

I disable org.eclipse.ui.forms.widgets.Hyperlink control just calling hyperLink.setEnabled(false).
However after that the link doesn't looks like disabled control. The link is not grayed out (but I can't click it of course).
The question is: why the link is not grayed out and what should I do to gray out disabled links?

Just extend Hyperlink and set the default colors. Alternatively you could create a composite delegate and forward the interface if it isn't too big - that's probably preferable.

Note that, in addition to Santosh's answer, with Eclipse 4.3 M6, you can restore the default color more easily, since you now have:
A new constant (SWT_COLOR_LINK_FOREGROUND) has been added that will return the native color of hyperlinks on all platforms.

did you try setting gray foreground explicitly ?
you can use following helper method:
public static void setEnabled(Link link, boolean enable){
if(link.isEnabled()!=enable){
if(enable)
link.setForeground(null); // resets to system's default color
else
link.setForeground(link.getDisplay().getSystemColor(SWT.COLOR_GRAY));
link.setEnabled(enable);
}
}

Related

TinyMCE - toggle dark-theme after init

after the tinymce.init() i can toggle the readOnly setting like this:
editor.mode.set("design");
editor.mode.set("readonly");
but how can i toggle the dark theme for the editor and the content?
this will not work:
editor.mode.set.content_css("dark");
editor.mode.set.skin("dark-oxide");
No, it is not possible. All the settings defined in the tinymce.init() function cannot be changed without reinitialization. However, reinitialization can be done very fast. You will need to perform 4 steps:
Save current content somewhere with getContent()
Destroy the TinyMCE instance with destroy()
Reinitialize
Use setContent() to add the content saved on step 1.

Can I change "OK" button style in Select Dialog to emphasized?

anyone know if sapui5 provide solution/function to change button style in select dialog? I've checked the SAPUI5 sdk but there is none for this solution.
If you are OK with using "private" properties then you can use _oOkButton property of SelectDialog or else you can use _getOkButton function which also is kind of "private" and returns ok button instance.
Just use the instance of the Select Dialog and get all buttons using the following methods. Select Dialog is a dialog only, you can use the methods of sap.m.Dialog
Let say you have the instance of the dialog as oSlectDialog then
oSlectDialog.getButtons() - will return all the Buttons in the footer. You can use loop them and give custom class accordingly.
var oBtns = oSlectDialog.getButtons()
for(var b in oBtns) {
var oBtn = oBtns[b];//You can check for button instance, if you want to add custom class differently.
oBtn.addStyleClass("YourCustomClass");
}
You can also use the sap.m.Dialog methods like oSlectDialog.getBeginButton(), oSlectDialog.getEndButton().
Since UI5 1.62.0, the primary action OK (later renamed to Select) is automatically emphasized if the theme is sap_fiori_3.
https://openui5.hana.ondemand.com/#/entity/sap.m.SelectDialog/sample/sap.m.sample.SelectDialog
If it's not urgent, I'd suggest to avoid relying on private methods/ properties, but update to the latest UI5 version and themes.
Update: and since 1.70 (commit:1f421b0), the button is automatically emphasized in other supported themes too, such as sap_belize, sap_belize_plus
Related Github issue: https://github.com/SAP/openui5/issues/2254

Editing JComponents on Standard screens

Is it possible to customize the JComponents on a built-in Standard Screen? Specifically, I've been asked to add a Required Disk Space label on the Installation Components screen that updates as different components are selected. I can get this label to appear by enabling the "Show installation directory chooser" property in the configuration of that screen, but can't figure out a way to prevent the display of the Destination Directory label/text field/button. com.install4j.runtime.beans.screens.ComponentsScreen is not an instance of com.install4j.api.screens.FormPanelContainer so I'm unable to interact with the FormEnvironment as I might on a custom screen.
Is there a way to either add my own dynamic label to this screen or edit/hide unwanted JComponents that are already there?
As of install4j 6.x, there is no was to do that without custom code. I think that the standard screens should just be templates composed of form components, so you can customize them. It's possible that we will do this install4j 7, but right now you would have to derive from
com.install4j.runtime.beans.screens.ComponentsScreen
and override addScreenContent like this:
#Override
protected void addScreenContent(JPanel panel, GridBagConstraints gc) {
super.addScreenContent(panel, gc);
gc.gridy++;
panel.add(new JLabel("your label"));
}

How can I use mnemonics on JavaFX 8 Alerts

I would like to be able to add accelerator keys for the buttons that are provided as a part of the Alert Dialog Controls included with JavaFX.
I am unsure if this is possible using the standard alert types ERROR, INFORMATION, CONFIRMATION, WARNING?
I created my own login window - which doesn't use an Alert structure and it works as follows:
When the stage opens up.
Then when the user hits the "ALT" key:
I would like the ability to "Hot Key" the buttons on the Alerts in the system. However, I am unsure if I can use the standard alerts, or if I need to create my own, and if so, how should I do that.
I really would like to use the Dialogs natively, if at all possible.
Thanks.
As far as I understood your question, I think it isn't possible without some extra code.
Looking at the code of OpenJFX the labels of the buttons are localized and fixed.
You might just want to create some buttons on your own by using the apropiate constructor which takes some buttons where you can override the existing ones.
EDIT: after rethinking everything, I tried to recreate your problem. You can see that project on GitHub..
This is the special code:
public void showCustomizedAlertWindow() {
Alert a = new Alert(AlertType.CONFIRMATION, "some content text", ButtonType.OK, ButtonType.CANCEL, ButtonType.FINISH);
((Button) a.getDialogPane().lookupButton(ButtonType.FINISH)).setText("_finished");
a.show();
}
But be aware, you are removing localization-support of that buttons.

disable back button on in ltk wizardinputpage

I'm doing a plugin in Eclipse IDE in order to do a refactoring. I'm using LTK, the point is: I don't know how I can disabled the back button after the preview. I've tried to create the RefactoringWizard using some flags like 'NO_BACK_BUTTON_ON_STATUS_DIALOG', but I think it is not the rigth way to do it.
The poblem I have in the background is that when I push preview and then push back, and preview again, the preview box shows the change related with the refactoring twice!.
I think the best solution is disabling the back button after the preview because this is the solution I have seen in others plugins.
Sorry because of my English and thanks beforehand.
The method org.eclipse.jface.wizard.WizardDialog#updateButtons disables the back button when currentPage.getPreviousPage() returns null. So, I suggest you to override the method org.eclipse.ltk.ui.refactoring.RefactoringWizard#getPreviousPage to return null.