My requirement is to remove the title icons for all views but it seems impossible.
First i removed the references to the icons from extension point="org.eclipse.ui.views" in my plugin.xml file.
There is a similar question to this one where it is suggested to override getTitleImage() in the view that extends ViewPart so i did just that and i tryed 2 versions.
#Override
public Image getTitleImage() {
return null;
}
#Override
public Image getTitleImage() {
return new Image(getSite().getShell().getDisplay(), new Rectangle(0, 0, 1, 1));
}
The result no matter which method i used is that some views don't display the icon and some do. For example the first view is always opened without the icon but the following views get the default icon. Also if i have save and restore enabled and restart the application while leaving some views open, the one that is selected doesn't have the icon while the rest do.
This is so frustrating, i just don't get why something so simple has to be so complicated to implement.
I think the problem is views that have not yet been created (so getTitleImage has not been called). In that case the workbench part reference code uses the default image if there is nothing defined in the view definition.
If the above is correct creating an empty image icon file and defining that as the icon in the org.eclipse.ui.views extension in your plugin.xml should work.
Related
I am trying to provide some default behavior to a standard Pane in Java FX. I would like to use this Pane in SceneBuilder. For some reason the layout isn't working as I would expect.
I created the following component:
public class GroupBox extends Pane {
public void configureGroupBox(String title) {
//Perform needed set up here.....
}
}
I have exported this control into a JAR file and imported that control into SceneBuilder. I am able to select this control in SceneBuilder and add it to my FXML.
However, the problem starts when I attempt to add controls within it. Even though this extends a javafx.scene.layout.Pane the layout engine of SceneBuilder is pushing all controls to the top left and overlapping them, rather than having no layout instructions.
Is what I am trying to do possible? If so, is there something else I need to do? At this point, my control is just an empty extension of the Pane class.
Thanks.
That is a Scene Builder limitation.
SB provides full operation for builtin containers only (i.e. the ones that are part of JavaFX). For custom containers, it provides limited operations: typically SB allows to drop a component inside but not to move it (because it considers that extending Pane does not imply free positioning of children).
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"));
}
Is there a way to add text next to the action icon in the toolbar of an eclipse RCP UI Form? If you do not assign the Action an ImageDescriptor, the action will be displayed containing only text. If you do give it an ImageDescriptor, it displays only the image. I want to display both side by side, within one button - is there a way to do this?
This will have only the text "Description" in the button on the toolbar:
myAction = new Action("Description", SWT.PUSH) {
#Override
public void run() {}
};
myForm.getToolBarManager().add(myAction);
But adding an image will cause the the text to be replaced:
myAction.setImageDescriptor(newImage);
I was eventually able to find an answer to my issue, hopefully it's helpful to anyone else who runs into this problem. I found this in the Eclipse Rich Client Platform (2nd Ed.) book.
The Action must be converted to an ActionContributionItem with its mode set to MODE_FORCE_TEXT. This will display both the text and the image in the toolbar.
ActionContributionItem aCI = new ActionContributionItem(myAction);
aCI.setMode(ActionContributionItem.MODE_FORCE_TEXT);
myForm.getToolBarManager().add(aCI);
I have a eclipse-plugin that have two perspectives. There is a view which extends ViewPart in one of the two perspectives. In this view, I overrided saveState method of ViewPart to save my data.
First, I open the prespective that has this view. Then i add some data in the view which should be save in saveState.
Next, I navigate to the other perspective that does not have this view.
Finally, I close the eclipse's workspace.
In eclipse 4.2(juno), saveState method of the view do not have been called. My data lost.
In eclipse 3.6(Helios), saveState method of the view have been called. My date has been persisted.
Does anyone know the reason? How can I insure that the saveState will be called when closing the workspace on all version of eclipse?
Eclipse e4 has no ApplicationWorkbenchAdvisor class and the application model has no property to set this,totally different with Eclipse 3.x.
You can get more from the wiki and vogella tutorial blog.
With joy, this problem persists into 4.4.2.
At its base, the issue is the compatibility layer WorkbenchPart.getViewReferences() only searches the currently active perspective. This behavior is different than the 3.x. The relevant code from the 4.4.2 Eclipse WorkbenchPart is here (notice the call to getCurrentPerspective()).
public IViewReference[] getViewReferences() {
MPerspective perspective = getCurrentPerspective();
if (perspective != null) {
List<MPlaceholder> placeholders = modelService.findElements(window, null,
MPlaceholder.class, null, EModelService.PRESENTATION);
List<IViewReference> visibleReferences = new ArrayList<IViewReference>();
for (ViewReference reference : viewReferences) {
for (MPlaceholder placeholder : placeholders) {
if (reference.getModel() == placeholder.getRef()
&& placeholder.isToBeRendered()) {
// only rendered placeholders are valid view references
visibleReferences.add(reference);
}
}
}
return visibleReferences.toArray(new IViewReference[visibleReferences.size()]);
}
return new IViewReference[0];
}
Therefore, if one has a view open and then changes to a perspective where that view is not shown, the saveState() method will not be called.
We have added an OSGI event listener for the UIEvents.UILifeCycle.appShutdownStarted and made a call to the saveState(). However, it is necessary to obtain the IMemento manually, since it is not present. Example code is in the org.eclipse.ui.internal.ViewReference (http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/4.2.2/org.eclipse.ui/workbench/3.104.0/org/eclipse/ui/internal/ViewReference.java#ViewReference).
One could also add a part close listener with the IPartListener class to potentially persist settings if the user closes the view rather than application shutting down.
We have not found an OSGI event for the part being closed, but there may be one.
This discussion (Eclipse call ViewPart saveState on View close) suggested using IDialogSettings rather the IMemento. This discussion also proposed perhaps adding something into the dispose() method, but it is unclear how many resources are necessarily still available at the point of the dispose() being called.
I'm writing my first iPhone app. I needed a custom switch (I want it to say "Male/Female" rather than "On/Off"), and I found RCSwitch but I'm having trouble figuring out how to integrate a downloaded widget into my project. I assume this is a fairly common thing to do, but I can't seem to find any documentation online on how to use a downloaded widget / class.
I have succeeded in adding the code in via Build Phases -> Link Binary with Libraries. An RCSwitch directory appears within my project tree, and if I do a diff I see that it has added code related to RCSwitch to the header files.
The problem is getting the widget onto the .storyboard image. The RCSwitch widget itself does not appear in the "Objects" box -- the one that is by default at the lower right of the screen and includes images of the widgets that you can drag into the storyboard. Perhaps I'm missing something?
from the xcode 4 transition guide (pg. 65):
Drag a custom view object from the library into the nib file.
After adding the custom view to your nib, select the custom view and
assign the correct class to it in the class field under Custom Class
in the Identity inspector
Some more resources:
iphone-creating-custom-objects-for-interface-builder
Interface Builder Help - Custom Object