Remove crop from transformation tool - java

I need to remove the crop feature from the TransformEditorTool or maybe leave only one aspect but I am not managing to do it.
I've tried add a aspectRatio as the documentation says(code below), but then every time I open the editor it redirects me for the transformation screen at first
What I've tried:
config.setAspects(new CropAspectConfig(20, 25));
And I've also tried to set the aspect direct into configuration on the TransformEditorTool, not in the global config, but then I am getting a null reference error.

to prevent this behavior, set ForceCrop to "SHOW_NEVER".
settingsList.getSettingsModel(TransformSettings.class).setForceCropMode(ForceCrop.SHOW_NEVER)
Best,
Sven

Related

Changing the priority of markers in eclipse

When I set a break point on a row which already has a marker(The value of the local variable is not used) on it, I cannot see the break point marker; because the yellow lamp marker covers the break point marker.
Is it possible to change the priority of the markers so that the break point sits on top of the lamp marker?
As long as #Mena answer is ok, as he sais...
Use at your own risk :)
This can be dangerous in a big project.
To avoid problems with hided warnings due configurations, what I usually do is:
Leave config as is, to see warnings.
Remove all really unnecessary lines causing warnings
Add an annotation to method still having warnings but needing breakpoint at same line. You can annotate class if necessary when massive warnings or breakpoints needed.
#SuppressWarning("unused")
public void yourMethod() {
}
This will allow you to handle warnings individually and see breakpoints when necessary.
I find that incredibly annoying too.
The only solution I've found is to go to the Java editor preferences, and disable the checkbox "Report problems as you type".
This will not change the priority, it will disable the hint and only show the breakpoint.
Here's a picture to illustrate:
Use at your own risk :)
Finally a TRUE relief after years of a so annoying and tiny thing:
1) go to your eclipse install path and look for all files (filename) that contain the word "warn" and are of the format .gif or .png (because they contain transparency data), here there were 5 files whose icon/image matched, most were named as: quickfix_warning_obj.gif (or.png)
2) rename all of them to *.DISABLED like "quickfix_warning_obj.gif.DISABLED", and as soon you restart eclipse, this will force it to restore the right one as soon you open an editor that uses it and has some warning on it.
3) having detected the right file, replace it with one of identical size (width and height in pixels), I would like to suggest this image I just created, so simple and not annoying at all and still is useful!
4) restart eclipse again and clap with a smiling face!
PS.: you can try to just replace this file also, that was the right one here for Eclipse Luna:
$ECLIPSE_INSTALL_PATH/configuration/org.eclipse.osgi/478/0/.cp/icons/full/obj16/quickfix_warning_obj.gif
Obs.:
Of course you can replace all of them that look the same, change other annoying icons and so on, and experiment with your own gif/png size and image, just that these steps is what worked perfectly here.
The image I supplied is almost invisible some times, but they were never really useful to me as I let the code with warning become underlined as a highlight. A better image is welcome :)
And, of course, this is a workaround, like a theme change, that does not involve any coding/recompiling of eclipse, therefore the priority is not changed at all, but the results are good enough to me at least.
EDIT: here one for the search results: searchm_obj.gif at configuration/org.eclipse.osgi/331/0/.cp/icons/full/obj16/searchm_obj.gif on Luna

E4 - how to remove caret from SourceViewer?

I need to show something very similiar to source code, but it shouldn't be possible to modify it (but i still need funcionality as paint annotation etc.). The use case is more like - you click on some line and something will happen, some annotation will be shown etc.).
So i decided to try to use eclipse application platform, because its jface.text looks very good.
I am trying to use SourceViewer for my purposes. It could be configured to not be editable, but it is still drawing the caret if you click into it.
QUESTION: How to disable painting of the caret?
EDIT: If you know something better than SourceViewer, which could fit to what i need, tell me please.
SourceViewer sv = new SourceViewer(parent, new CompositeRuler(), 0);
sv.setEditable(false);
sv.configure(new SourceViewerConfiguration());
sv.addVerticalRulerColumn(new LineNumberRulerColumn());
sv.setDocument(new Document(""));
Looks like you should be able to set the caret to null with:
sv.getTextWidget().setCaret(null);

Eclipse Plugin: Highlight Code Line (textmarker while debugging)

Please do not confuse this with 'selecting code' like selecting code with a mouse.
When my debug device hits a break point I want to highlight the specific line of code.
I am using the CDT Plugin.
I already got the lineNumber and all I want to do now is to tell
editor.highlightLine(lineNumber);
to get something like this:
I already tried this:
marker = resource.createMarker(IMarker.TEXT);
marker.setAttribute(IMarker.LINE_NUMBER, 10);
marker.setAttribute(IMarker.CHAR_START, 0);
marker.setAttribute(IMarker.CHAR_END, 10);
but it didn't work.
Since there are already predefined annotations provided by Eclipse and/or the CDT Plugin I'd like to reuse them. But how to access and use them inside sourcecode?
You can create your own marker using an extension point "org.eclipse.core.resources.markers" and adding super attribute of type "org.eclipse.core.resources.textmarker". After setting up your marker, you still need to describe its look and feel by adding the annotation extension point "org.eclipse.ui.editors.annotationTypes"
I am not exactly sure of your intentions but this link might help http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-plugin-guide/section3.html
Marker is the thing on your ruler. You need to look at the editor background painting. Take a look at InstructionPointerManager.java
I had the same problem. And I solve it by creating my own marker. I follow the step of this blog http://cubussapiens.hu/2011/05/custom-markers-and-annotations-the-bright-side-of-eclipse/ and create a marker when the lineNumber changed. It will highlight this line.

Getting rid of flicker in SWT

We are using a the following class to show a progress-bar in our Java application: TextProgressBar
Unfortunately we are having some problems with flickering when using that (Win 7, Java 7). Do you have any tips on how we can avoid that? Can we somehow repaint it less frequently, use double-buffering or something else? Any tips are greatly appreciated!
First, try passing SWT.DOUBLE_BUFFERED in for the style parameter on construction. If that fails to improve the situation, move up the parent chain and add SWT.DOUBLE_BUFFERED to their constructor call instead.
If you don't have control over the parent, then you'll likely need to wrap your control in another Composite that has this flag enabled.
try SWT.NO_BACKGROUND first, and if not use SWT.DOUBLE_BUFFERED.
Do not use both at the same time, because there is no point.
See the discussion
Disclaimer: I know that the question asks specifically about the TextProgressBar. However, I believe that many views of this question are not limited to this widget.
I had a problem with the flickering of the Text widget, which I could not resolve neither by using the SWT.DOUBLE_BUFFERED style, nor by wrapping it with the Composite, nor by applying any combination of them.
Finally, I was able to resolve this problem by simply changing the widget type from Text to StyledText. There is no flicker even without the SWT.DOUBLE_BUFFERED style and without the Composite wrapper.
Hope this will help someone who was attracted by the broad title of this question.
you can try delaying the time with thread.sleep(). It worked for me when i had the same problem when working with jTables

Eclipse PDE: Custom QuickFix only available in Problems View?

i am having trouble with custom quick-fixes, which i want to provide in my Eclipse plug-in, and i'm hoping for someone more experienced than me in Eclipse PDE to have some hints for me on this issue.
As i have understood, i can provide custom so-called "quick fixes" (or "resolutions", in Eclipse inside terminology), by extending the extension point org.eclipse.ui.ide.markerResolution for a specific marker id, such as for example some default Eclipse marker, org.eclipse.core.resources.problemmarker.
This works for me for the default marker types and for custom marker types, BUT:
The QuickFixes, which my IMarkerResolutionGenerator provides, are only accessible from the "Problems"-View, not from the Editor, in which my markers show up.
What i have: I create markers in the default text editor, which causes (1) an icon with the markers tooltip message to show up on the left editor ruler at the line, which the marker is assigned to, (2) a marker on the right side of the editor, (3) some underlined characters in the editor, and (4) an entry in the "Problems"-view.
What i want: Just like in Java IDE support, i want to press Strg+1, or Context-Menu->Quick Fix, or to click at the error icon on the left-side-ruler, to see the available quick-fixes and to select one.
However: Only in the Problems-View am i able to get the Quick-Fixes, by pressing Strg+1 or from the context menu.
Is this the normal behaviour, and do i have to access another extension point, or the specific editors features, to hook my quick fixes into them? I haven't found anything much detailed about it, except that everybody seems to be pretty happy with this only extension point that i have mentioned above. What am i missing?
For completion, here is my extension point definition:
<extension point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="com.markers.test.MarkerResolutionGenerator"
markerType="org.eclipse.core.resources.problemmarker">
</markerResolutionGenerator>
</extension>
I have the same problem and I'm not sure, if this is the right way, but at least it works:
If you want to see your quick fixes in the source viewer you have to set an QuickAssistAssistant for it. In your class implementing SourceViewerConfiguration override getQuickAssistAssistant. You can instantiate org.eclipse.jface.text.quickassist.QuickAssistAssistant, but you have to set a QuickAssistProcessor, so implement the org.eclipse.jface.text.quickassist.IQuickAssistProcessor interface, especially computeQuickAssistProposals to return your quick fix proposals.
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
IQuickAssistAssistant quickAssist = new QuickAssistAssistant();
quickAssist.setQuickAssistProcessor(new MyQuickAssistProcessor());
quickAssist.setInformationControlCreator(getInformationControlCreator(sourceViewer));
return quickAssist;
}
Also have a look at the code in the last post here, it is a bit messy, but you will get it. And look at this code here for an example implementation of ICompletionProposal, which you will have to return in your QuickAssistProcessor.
If you simply add one line to the marker extension point:
<super type="org.eclipse.core.resources.textmarker"/>
and add attributes to the marker
marker.setAttribute(IMarker.CHAR_START, ...);
marker.setAttribute(IMarker.CHAR_END, ...);
You will be able get this:
But I still can't found how to change marker icon (to variant with bulb) a show possible quick fix also after click on the annotation icon.

Categories

Resources