-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataset Collection. Fixing problems with inlining #85
Merged
Merged
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0cdcfe5
fixed problem with comments
Vitaly-Protasov c74b1b5
fixed invocation inside other statements
Vitaly-Protasov 12d1dbf
Merge branch 'master' of https://github.com/cqfn/veniq into issue-50_5
Vitaly-Protasov c95ca2c
fixed invocation inside other statements
Vitaly-Protasov 08d69b5
fixed flake and logic
Vitaly-Protasov 7bd36e5
fixed flake and logic
Vitaly-Protasov a94320a
fixed flake and logic
Vitaly-Protasov 6826e38
added test for nesting
Vitaly-Protasov 48593db
added new statements
Vitaly-Protasov c9a657c
fixed previous problem with inlining declaration var
Vitaly-Protasov b8028f4
fixed inling spaces
Vitaly-Protasov cc61660
added more statement
Vitaly-Protasov da8b094
resolved conflict
Vitaly-Protasov 751d71b
resolved conflict
Vitaly-Protasov 7936613
fixed test
Vitaly-Protasov f43eb24
pulled master
Vitaly-Protasov 42218e6
added try
Vitaly-Protasov 91c9432
fixed bug with none bounds
Vitaly-Protasov 68c40c7
ADd exception
lyriccoder f673378
Fix
lyriccoder 793cf11
Merge branch 'master' into issue-50_5
lyriccoder a115b2d
Merge branch 'validation' of https://github.com/cqfn/veniq into issue…
lyriccoder e0800cf
Merge branch 'master' of https://github.com/cqfn/veniq into issue-50_5
lyriccoder 66021b8
Merge branch 'issue-50_5' of https://github.com/cqfn/veniq into issue…
lyriccoder 17aee1d
Fix some prints
lyriccoder de11b43
Merge branch 'master' of https://github.com/cqfn/veniq into issue-50_5
lyriccoder 6bb826d
Update veniq/dataset_collection/augmentation.py
lyriccoder 49ce379
Fix comments + added tests
lyriccoder f199815
Merge branch 'issue-50_5' of https://github.com/cqfn/veniq into issue…
lyriccoder b9815e3
Fix flake8
lyriccoder f165c0e
Fix path in integration tests
lyriccoder c0a4a75
Fix test file
lyriccoder 9f60b2f
Fix data \r
lyriccoder ec4b367
Update augmentation.py
lyriccoder 1a349b9
Update test/dataset_collection/test_dataset_collection.py
lyriccoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
public class UninstallStep implements WizardDescriptor.FinishablePanel<WizardDescriptor> { | ||
private void doAction () { | ||
// proceed operation | ||
Restarter r; | ||
try { | ||
if ((r = handleAction ()) != null) { | ||
presentActionNeedsRestart (r); | ||
} else { | ||
presentActionDone (); | ||
} | ||
} catch (OperationException ex) { | ||
presentActionFailed (ex); | ||
} | ||
fireChange (); | ||
} | ||
|
||
private Restarter handleAction () throws OperationException { | ||
assert model.getBaseContainer () != null : "getBaseContainers() returns not null container."; | ||
support = (OperationSupport) model.getBaseContainer ().getSupport (); | ||
assert support != null : "OperationSupport cannot be null because OperationContainer " + | ||
"contains elements: " + model.getBaseContainer ().listAll () + " and invalid elements " + model.getBaseContainer ().listInvalid (); | ||
if (support == null) { | ||
err.log(Level.WARNING, "OperationSupport cannot be null because OperationContainer contains elements: " | ||
+ "{0} and invalid elements {1}", new Object[]{model.getBaseContainer().listAll(), model.getBaseContainer().listInvalid()}); | ||
if (!model.getBaseContainer().listInvalid().isEmpty()) { | ||
// cannot continue if there are invalid elements | ||
throw new OperationException(OperationException.ERROR_TYPE.UNINSTALL, | ||
UninstallStep_NullSupport_InvalidElements(model.getBaseContainer().listInvalid())); | ||
} else if (model.getBaseContainer().listAll().isEmpty()) { | ||
// it's weird, there must be any elemets for uninstall | ||
throw new OperationException(OperationException.ERROR_TYPE.UNINSTALL, | ||
UninstallStep_NullSupport_NullElements()); | ||
} | ||
throw new OperationException(OperationException.ERROR_TYPE.UNINSTALL, | ||
"OperationSupport cannot be null because OperationContainer " | ||
+ "contains elements: " + model.getBaseContainer().listAll() + " and invalid elements " + model.getBaseContainer().listInvalid()); | ||
} | ||
ProgressHandle handle = null; | ||
switch (model.getOperation ()) { | ||
case UNINSTALL : | ||
handle = ProgressHandleFactory.createHandle(UninstallStep_ProgressName_Uninstall()); | ||
break; | ||
case ENABLE : | ||
handle = ProgressHandleFactory.createHandle(UninstallStep_ProgressName_Activate()); | ||
break; | ||
case DISABLE : | ||
handle = ProgressHandleFactory.createHandle(UninstallStep_ProgressName_Deactivate()); | ||
break; | ||
default: | ||
assert false : "Unknown OperationType " + model.getOperation (); | ||
} | ||
|
||
JComponent progressComponent = ProgressHandleFactory.createProgressComponent (handle); | ||
JLabel mainLabel = ProgressHandleFactory.createMainLabelComponent (handle); | ||
JLabel detailLabel = ProgressHandleFactory.createDetailLabelComponent (handle); | ||
model.modifyOptionsForDisabledCancel (wd); | ||
|
||
panel.waitAndSetProgressComponents (mainLabel, progressComponent, detailLabel); | ||
|
||
Restarter r = null; | ||
try { | ||
r = support.doOperation (handle); | ||
panel.waitAndSetProgressComponents(mainLabel, progressComponent, new JLabel(UninstallStep_Done())); | ||
} catch (OperationException ex) { | ||
err.log (Level.INFO, ex.getMessage (), ex); | ||
panel.waitAndSetProgressComponents(mainLabel, progressComponent, | ||
new JLabel(UninstallStep_Failed(ex.getLocalizedMessage()))); | ||
throw ex; | ||
} | ||
return r; | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
test/dataset_collection/InlineExamples/ObjectProperties_cut.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
|
||
public class ObjectPropertiesEditor extends AbstractDatabaseObjectEditor<DBSObject> implements IEntityStructureEditor, | ||
IRefreshablePart, | ||
IProgressControlProvider, | ||
ITabbedFolderContainer, | ||
ISearchContextProvider, | ||
INavigatorModelView, | ||
IEntityEditorContext, | ||
IDatabasePostSaveProcessor | ||
{ | ||
private void createPropertyBrowser(Composite container) | ||
{ | ||
pageControl.setRedraw(false); | ||
try { | ||
TabbedFolderInfo[] folders = collectFolders(this); | ||
if (folders.length == 0) { | ||
createPropertiesPanel(container); | ||
} else { | ||
Composite foldersParent = container; | ||
if (hasPropertiesEditor() && DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.ENTITY_EDITOR_DETACH_INFO)) { | ||
sashForm = UIUtils.createPartDivider(getSite().getPart(), container, SWT.VERTICAL); | ||
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); | ||
foldersParent = sashForm; | ||
|
||
createPropertiesPanel(sashForm); | ||
} | ||
createFoldersPanel(foldersParent, folders); | ||
} | ||
|
||
// Create props | ||
if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.ENTITY_EDITOR_DETACH_INFO)) { | ||
if (hasPropertiesEditor()) { | ||
propertiesPanel = new TabbedFolderPageForm(this, pageControl, getEditorInput()); | ||
|
||
propertiesPanel.createControl(propsPlaceholder); | ||
} | ||
} | ||
|
||
if (sashForm != null) { | ||
//Runnable sashUpdater = this::updateSashWidths; | ||
//sashUpdater.run(); | ||
//UIUtils.asyncExec(sashUpdater); | ||
updateSashWidths(); | ||
} | ||
pageControl.layout(true, true); | ||
} finally { | ||
pageControl.setRedraw(true); | ||
} | ||
} | ||
|
||
private void updateSashWidths() { | ||
if (sashForm.isDisposed()) { | ||
return; | ||
} | ||
|
||
// if (propsPlaceholder != null) { | ||
Point propsSize = propsPlaceholder.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); | ||
Point sashSize = sashForm.getParent().getSize(); | ||
if (sashSize.x <= 0 || sashSize.y <= 0) { | ||
// This may happen if EntityEditor created with some other active editor (i.e. props editor not visible) | ||
propsSize.y += 10; | ||
sashSize = getParentSize(sashForm); | ||
//sashSize.y += 20; | ||
} | ||
if (sashSize.x > 0 && sashSize.y > 0) { | ||
float ratio = (float) propsSize.y / (float) sashSize.y; | ||
int propsRatio = Math.min(1000, (int) (1000 * ratio)); | ||
int[] newWeights = {propsRatio, 1000 - propsRatio}; | ||
if (!Arrays.equals(newWeights, sashForm.getWeights())) { | ||
sashForm.setWeights(newWeights); | ||
//sashForm.layout(); | ||
} | ||
} | ||
|
||
/* | ||
} else { | ||
String sashStateStr = DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE); | ||
int sashPanelHeight = !CommonUtils.isEmpty(sashStateStr) ? Integer.parseInt(sashStateStr) : 400; | ||
if (sashPanelHeight < 0) sashPanelHeight = 0; | ||
if (sashPanelHeight > 1000) sashPanelHeight = 1000; | ||
|
||
sashForm.setWeights(new int[] { sashPanelHeight, 1000 - sashPanelHeight }); | ||
//sashForm.layout(); | ||
|
||
sashForm.getChildren()[0].addListener(SWT.Resize, event -> { | ||
if (sashForm != null) { | ||
int[] weights = sashForm.getWeights(); | ||
if (weights != null && weights.length > 0) { | ||
int topWeight = weights[0]; | ||
if (topWeight == 0) topWeight = 1; | ||
DBWorkbench.getPlatform().getPreferenceStore().setValue(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE, topWeight); | ||
} | ||
} | ||
}); | ||
} | ||
*/ | ||
} | ||
|
||
} |
143 changes: 143 additions & 0 deletions
143
test/dataset_collection/InlineTestExamples/ObjectProperties_cut.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
|
||
public class ObjectPropertiesEditor extends AbstractDatabaseObjectEditor<DBSObject> implements IEntityStructureEditor, | ||
IRefreshablePart, | ||
IProgressControlProvider, | ||
ITabbedFolderContainer, | ||
ISearchContextProvider, | ||
INavigatorModelView, | ||
IEntityEditorContext, | ||
IDatabasePostSaveProcessor | ||
{ | ||
private void createPropertyBrowser(Composite container) | ||
{ | ||
pageControl.setRedraw(false); | ||
try { | ||
TabbedFolderInfo[] folders = collectFolders(this); | ||
if (folders.length == 0) { | ||
createPropertiesPanel(container); | ||
} else { | ||
Composite foldersParent = container; | ||
if (hasPropertiesEditor() && DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.ENTITY_EDITOR_DETACH_INFO)) { | ||
sashForm = UIUtils.createPartDivider(getSite().getPart(), container, SWT.VERTICAL); | ||
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); | ||
foldersParent = sashForm; | ||
|
||
createPropertiesPanel(sashForm); | ||
} | ||
createFoldersPanel(foldersParent, folders); | ||
} | ||
|
||
// Create props | ||
if (DBWorkbench.getPlatform().getPreferenceStore().getBoolean(NavigatorPreferences.ENTITY_EDITOR_DETACH_INFO)) { | ||
if (hasPropertiesEditor()) { | ||
propertiesPanel = new TabbedFolderPageForm(this, pageControl, getEditorInput()); | ||
|
||
propertiesPanel.createControl(propsPlaceholder); | ||
} | ||
} | ||
|
||
if (sashForm != null) { | ||
//Runnable sashUpdater = this::updateSashWidths; | ||
//sashUpdater.run(); | ||
//UIUtils.asyncExec(sashUpdater); | ||
if (sashForm.isDisposed()) { | ||
return; | ||
} | ||
|
||
// if (propsPlaceholder != null) { | ||
Point propsSize = propsPlaceholder.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); | ||
Point sashSize = sashForm.getParent().getSize(); | ||
if (sashSize.x <= 0 || sashSize.y <= 0) { | ||
// This may happen if EntityEditor created with some other active editor (i.e. props editor not visible) | ||
propsSize.y += 10; | ||
sashSize = getParentSize(sashForm); | ||
//sashSize.y += 20; | ||
} | ||
if (sashSize.x > 0 && sashSize.y > 0) { | ||
float ratio = (float) propsSize.y / (float) sashSize.y; | ||
int propsRatio = Math.min(1000, (int) (1000 * ratio)); | ||
int[] newWeights = {propsRatio, 1000 - propsRatio}; | ||
if (!Arrays.equals(newWeights, sashForm.getWeights())) { | ||
sashForm.setWeights(newWeights); | ||
//sashForm.layout(); | ||
} | ||
} | ||
|
||
/* | ||
} else { | ||
String sashStateStr = DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE); | ||
int sashPanelHeight = !CommonUtils.isEmpty(sashStateStr) ? Integer.parseInt(sashStateStr) : 400; | ||
if (sashPanelHeight < 0) sashPanelHeight = 0; | ||
if (sashPanelHeight > 1000) sashPanelHeight = 1000; | ||
|
||
sashForm.setWeights(new int[] { sashPanelHeight, 1000 - sashPanelHeight }); | ||
//sashForm.layout(); | ||
|
||
sashForm.getChildren()[0].addListener(SWT.Resize, event -> { | ||
if (sashForm != null) { | ||
int[] weights = sashForm.getWeights(); | ||
if (weights != null && weights.length > 0) { | ||
int topWeight = weights[0]; | ||
if (topWeight == 0) topWeight = 1; | ||
DBWorkbench.getPlatform().getPreferenceStore().setValue(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE, topWeight); | ||
} | ||
} | ||
}); | ||
} | ||
*/ | ||
} | ||
pageControl.layout(true, true); | ||
} finally { | ||
pageControl.setRedraw(true); | ||
} | ||
} | ||
|
||
private void updateSashWidths() { | ||
if (sashForm.isDisposed()) { | ||
return; | ||
} | ||
|
||
// if (propsPlaceholder != null) { | ||
Point propsSize = propsPlaceholder.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); | ||
Point sashSize = sashForm.getParent().getSize(); | ||
if (sashSize.x <= 0 || sashSize.y <= 0) { | ||
// This may happen if EntityEditor created with some other active editor (i.e. props editor not visible) | ||
propsSize.y += 10; | ||
sashSize = getParentSize(sashForm); | ||
//sashSize.y += 20; | ||
} | ||
if (sashSize.x > 0 && sashSize.y > 0) { | ||
float ratio = (float) propsSize.y / (float) sashSize.y; | ||
int propsRatio = Math.min(1000, (int) (1000 * ratio)); | ||
int[] newWeights = {propsRatio, 1000 - propsRatio}; | ||
if (!Arrays.equals(newWeights, sashForm.getWeights())) { | ||
sashForm.setWeights(newWeights); | ||
//sashForm.layout(); | ||
} | ||
} | ||
|
||
/* | ||
} else { | ||
String sashStateStr = DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE); | ||
int sashPanelHeight = !CommonUtils.isEmpty(sashStateStr) ? Integer.parseInt(sashStateStr) : 400; | ||
if (sashPanelHeight < 0) sashPanelHeight = 0; | ||
if (sashPanelHeight > 1000) sashPanelHeight = 1000; | ||
|
||
sashForm.setWeights(new int[] { sashPanelHeight, 1000 - sashPanelHeight }); | ||
//sashForm.layout(); | ||
|
||
sashForm.getChildren()[0].addListener(SWT.Resize, event -> { | ||
if (sashForm != null) { | ||
int[] weights = sashForm.getWeights(); | ||
if (weights != null && weights.length > 0) { | ||
int topWeight = weights[0]; | ||
if (topWeight == 0) topWeight = 1; | ||
DBWorkbench.getPlatform().getPreferenceStore().setValue(NavigatorPreferences.ENTITY_EDITOR_INFO_SASH_STATE, topWeight); | ||
} | ||
} | ||
}); | ||
} | ||
*/ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some empty lines in the method body to break it into logical blocks for better understandability.