fix sonarlint messages
This commit is contained in:
@ -287,5 +287,5 @@
|
||||
<addons xmi:id="_95PftnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.handler.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
|
||||
<addons xmi:id="_95Pft3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
|
||||
<addons xmi:id="_95PfuHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
|
||||
<addons xmi:id="_zSk-cIkcEeWxJ_wPkM6yGQ" elementId="org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon"/>
|
||||
<addons xmi:id="_zSk-cIkcEeWxJ_wPkM6yGQ" elementId="org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon"/>
|
||||
</application:Application>
|
||||
|
@ -8,7 +8,7 @@ public class AppModelId {
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_COMMANDS_MODEL = "org.eclipse.e4.ui.workbench.commands.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_CONTEXTS_MODEL = "org.eclipse.e4.ui.workbench.contexts.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_HANDLER_MODEL = "org.eclipse.e4.ui.workbench.handler.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENC__H_ADDONS_DNDADDON_DNDADDON = "org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_ADDONS_DNDADDON_DNDADDON = "org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon";
|
||||
public static final String APPLICATION_ORG_ECLIPSE_E4_IDE_APPLICATION = "org.eclipse.e4.ide.application";
|
||||
public static final String BINDINGCONTEXT_ORG_ECLIPSE_UI_CONTEXTS_DIALOG = "org.eclipse.ui.contexts.dialog";
|
||||
public static final String BINDINGCONTEXT_ORG_ECLIPSE_UI_CONTEXTS_DIALOGANDWINDOW = "org.eclipse.ui.contexts.dialogAndWindow";
|
||||
@ -152,4 +152,6 @@ public class AppModelId {
|
||||
public static final String TRIMBAR_ORG_ECLIPSE_UI_MAIN_TOOLBAR = "org.eclipse.ui.main.toolbar";
|
||||
public static final String TRIMBAR_ORG_ECLIPSE_UI_TRIM_STATUS = "org.eclipse.ui.trim.status";
|
||||
public static final String WINDOW_COM_MINRES_SCVIEWER_E4_APPLICATION_DIALOG_ABOUTSCVIEWER = "com.minres.scviewer.e4.application.dialog.aboutscviewer";
|
||||
|
||||
private AppModelId(){}
|
||||
}
|
@ -12,12 +12,12 @@ package com.minres.scviewer.e4.application;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.core.services.log.Logger;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
||||
@ -32,9 +32,6 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||
import org.eclipse.equinox.app.IApplicationContext;
|
||||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.osgi.service.event.Event;
|
||||
import org.osgi.service.event.EventHandler;
|
||||
import org.eclipse.e4.core.services.log.Logger;
|
||||
|
||||
import com.minres.scviewer.e4.application.options.Options;
|
||||
import com.minres.scviewer.e4.application.options.Options.Multiplicity;
|
||||
@ -49,15 +46,6 @@ import com.minres.scviewer.e4.application.options.Options.Separator;
|
||||
public class E4LifeCycle {
|
||||
|
||||
@Inject private Logger logger;
|
||||
|
||||
/**
|
||||
* Post construct.
|
||||
*
|
||||
* @param eventBroker the event broker
|
||||
*/
|
||||
@PostConstruct
|
||||
private static void postConstruct(final IEventBroker eventBroker) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post context create. Open a database if given on command line using the OpenViewHandler
|
||||
@ -68,47 +56,44 @@ public class E4LifeCycle {
|
||||
@PostContextCreate
|
||||
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker,
|
||||
final IEclipseContext workbenchContext) {
|
||||
|
||||
|
||||
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
||||
final Options opt = new Options(args, 0, Integer.MAX_VALUE);
|
||||
opt.getSet()
|
||||
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
|
||||
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
|
||||
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||
if (!opt.check(Options.DEFAULT_SET, true, false)) {
|
||||
logger.error(opt.getCheckErrors());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
Location instanceLocation = Platform.getInstanceLocation();
|
||||
try {
|
||||
boolean isLocked = instanceLocation.isLocked();
|
||||
if(isLocked)
|
||||
instanceLocation.release();
|
||||
} catch (IOException e) { }
|
||||
if(!opt.getSet().getData().isEmpty()) {
|
||||
Display.getCurrent().timerExec (100, () -> {
|
||||
MApplication app= workbenchContext.get(MApplication.class);
|
||||
EModelService modelService = workbenchContext.get(EModelService.class);
|
||||
EPartService partService= workbenchContext.get(EPartService.class);
|
||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(opt.getSet().getData().get(0));
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.CREATE);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx = part.getContext();
|
||||
ctx.modify("input", opt.getSet().getData());
|
||||
String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
});
|
||||
}
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, event -> {
|
||||
Location instanceLocation = Platform.getInstanceLocation();
|
||||
try {
|
||||
boolean isLocked = instanceLocation.isLocked();
|
||||
if(isLocked)
|
||||
instanceLocation.release();
|
||||
} catch (IOException e) { }
|
||||
if(!opt.getSet().getData().isEmpty()) {
|
||||
Display.getCurrent().timerExec (100, () -> {
|
||||
MApplication app= workbenchContext.get(MApplication.class);
|
||||
EModelService modelService = workbenchContext.get(EModelService.class);
|
||||
EPartService partService= workbenchContext.get(EPartService.class);
|
||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(opt.getSet().getData().get(0));
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.CREATE);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx = part.getContext();
|
||||
ctx.modify("input", opt.getSet().getData());
|
||||
String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pre save.
|
||||
*
|
||||
|
@ -53,8 +53,34 @@ public class HeapStatus extends Composite {
|
||||
private Image disabledGcImage;
|
||||
|
||||
/** The arm col. */
|
||||
private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol,
|
||||
armCol;
|
||||
private Color bgCol;
|
||||
|
||||
/** The used mem col. */
|
||||
private Color usedMemCol;
|
||||
|
||||
/** The low mem col. */
|
||||
private Color lowMemCol;
|
||||
|
||||
/** The free mem col. */
|
||||
private Color freeMemCol;
|
||||
|
||||
/** The top left col. */
|
||||
private Color topLeftCol;
|
||||
|
||||
/** The bottom right col. */
|
||||
private Color bottomRightCol;
|
||||
|
||||
/** The sep col. */
|
||||
private Color sepCol;
|
||||
|
||||
/** The text col. */
|
||||
private Color textCol;
|
||||
|
||||
/** The mark col. */
|
||||
private Color markCol;
|
||||
|
||||
/** The arm col. */
|
||||
private Color armCol;
|
||||
|
||||
/** The button. */
|
||||
private Canvas button;
|
||||
@ -241,6 +267,11 @@ public class HeapStatus extends Composite {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background.
|
||||
*
|
||||
* @param color the new background
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -254,6 +285,11 @@ public class HeapStatus extends Composite {
|
||||
button.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the foreground.
|
||||
*
|
||||
* @param color the new foreground
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -272,6 +308,11 @@ public class HeapStatus extends Composite {
|
||||
button.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the foreground.
|
||||
*
|
||||
* @return the foreground
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -329,6 +370,14 @@ public class HeapStatus extends Composite {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute size.
|
||||
*
|
||||
* @param wHint the w hint
|
||||
* @param hHint the h hint
|
||||
* @param changed the changed
|
||||
* @return the point
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -681,6 +730,9 @@ public class HeapStatus extends Composite {
|
||||
super("&Set Mark");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run.
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -704,6 +756,9 @@ public class HeapStatus extends Composite {
|
||||
super("&Clear Mark");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run.
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@ -729,6 +784,9 @@ public class HeapStatus extends Composite {
|
||||
setChecked(showMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run.
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -109,10 +109,7 @@ public class AboutDialog extends Dialog {
|
||||
styleRange.fontStyle = SWT.BOLD;
|
||||
styledText.setStyleRange(styleRange);
|
||||
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
|
||||
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"); //$NON-NLS-1$
|
||||
// in case you would like to ignore case sensitivity,
|
||||
// you could use this statement:
|
||||
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);
|
||||
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"/*, Pattern.CASE_INSENSITIVE*/); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(productTitle+copyrightText);
|
||||
// check all occurance
|
||||
while (matcher.find()) {
|
||||
|
@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.e4.application.Constants;
|
||||
|
||||
@ -249,7 +250,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
|
||||
fileNameEntry = new Text(bottomBar, SWT.BORDER);
|
||||
fileNameEntry.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
fileNameEntry.setEditable(false); //TODO: temporary disabled
|
||||
fileNameEntry.setEditable(false);
|
||||
fileNameEntry.setEnabled(false);
|
||||
|
||||
filterCombo = new Combo(bottomBar, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
|
||||
@ -457,7 +458,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
return globber.matches(element) || ((File)element).isDirectory()? null: ResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
return globber.matches(element) || ((File)element).isDirectory()? null: SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -138,35 +138,33 @@ public class ResourceManager extends SWTResourceManager {
|
||||
decoratedImageMap[corner] = cornerDecoratedImageMap;
|
||||
}
|
||||
Map<Image, Image> decoratedMap = cornerDecoratedImageMap.computeIfAbsent(baseImage, k -> new HashMap<Image, Image>());
|
||||
Image result = decoratedMap.get(decorator);
|
||||
if (result == null) {
|
||||
final Rectangle bib = baseImage.getBounds();
|
||||
final Rectangle dib = decorator.getBounds();
|
||||
final Point baseImageSize = new Point(bib.width, bib.height);
|
||||
CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
|
||||
@Override
|
||||
protected void drawCompositeImage(int width, int height) {
|
||||
drawImage(createCachedImageDataProvider(baseImage), 0, 0);
|
||||
if (corner == TOP_LEFT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()) , 0, 0);
|
||||
} else if (corner == TOP_RIGHT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, 0);
|
||||
} else if (corner == BOTTOM_LEFT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), 0, bib.height - dib.height);
|
||||
} else if (corner == BOTTOM_RIGHT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, bib.height - dib.height);
|
||||
}
|
||||
return decoratedMap.computeIfAbsent(decorator, k -> createImage(baseImage, decorator, corner));
|
||||
}
|
||||
|
||||
private static Image createImage(final Image baseImage, final Image decorator, final int corner) {
|
||||
final Rectangle bib = baseImage.getBounds();
|
||||
final Rectangle dib = decorator.getBounds();
|
||||
final Point baseImageSize = new Point(bib.width, bib.height);
|
||||
CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
|
||||
@Override
|
||||
protected void drawCompositeImage(int width, int height) {
|
||||
drawImage(createCachedImageDataProvider(baseImage), 0, 0);
|
||||
if (corner == TOP_LEFT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()) , 0, 0);
|
||||
} else if (corner == TOP_RIGHT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, 0);
|
||||
} else if (corner == BOTTOM_LEFT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), 0, bib.height - dib.height);
|
||||
} else if (corner == BOTTOM_RIGHT) {
|
||||
drawImage(getUnzoomedImageDataProvider(decorator.getImageData()), bib.width - dib.width, bib.height - dib.height);
|
||||
}
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
return baseImageSize;
|
||||
}
|
||||
};
|
||||
//
|
||||
result = compositImageDesc.createImage();
|
||||
decoratedMap.put(decorator, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
return baseImageSize;
|
||||
}
|
||||
};
|
||||
return compositImageDesc.createImage();
|
||||
}
|
||||
|
||||
private static ImageDataProvider getUnzoomedImageDataProvider(ImageData imageData) {
|
||||
|
Reference in New Issue
Block a user