Skip to content
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

Clone Management #67

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
7d059a8
clone and paste actions created
Ahmad-sh7 Dec 21, 2023
31b1c48
vpIntegration package created
Ahmad-sh7 Dec 21, 2023
d89deb1
Clone trace via cloning action created
Ahmad-sh7 Dec 21, 2023
f8c1991
getting psiFiles
Ahmad-sh7 Jan 8, 2024
d5f161e
read asset type and get highlighted code
Ahmad-sh7 Jan 14, 2024
9f82e99
cloning asset file implemented
Ahmad-sh7 Jan 21, 2024
0993df8
Directory Asset: created new cloned directory
Ahmad-sh7 Jan 24, 2024
93f1199
implemented cloning directory asset
Ahmad-sh7 Jan 24, 2024
c86dce4
get the psiMethod of cursor position
Ahmad-sh7 Jan 25, 2024
e0b1d7c
paste psiElements of highlighted code block
Ahmad-sh7 Jan 25, 2024
c24830d
paste psiMethods and psiClasses
Ahmad-sh7 Jan 25, 2024
08683d0
paste cloned Block
Ahmad-sh7 Jan 27, 2024
eb879e7
tracing handler created
Ahmad-sh7 Jan 27, 2024
aa761c8
bug fix and path of psi methods and classes stored
Ahmad-sh7 Jan 27, 2024
0aced3a
git ignore trace-db.txt
Ahmad-sh7 Jan 27, 2024
dd6212d
Remove trace-db.txt from tracking
Ahmad-sh7 Jan 27, 2024
6b067ca
stored pathes of class,method and block asset types
Ahmad-sh7 Jan 28, 2024
f8dc9a5
implemented handling feature names of cloned assets
Ahmad-sh7 Jan 29, 2024
94dc505
actions combined and code refactored
Ahmad-sh7 Jan 30, 2024
4fcf6ee
finding features through language injection host
Ahmad-sh7 Feb 1, 2024
6f08d91
save trace of current class name when cloning method
Ahmad-sh7 Feb 8, 2024
cf340cc
extract file mapping features
Ahmad-sh7 Feb 9, 2024
b1380bd
handle feature-to-file when cloning assets
Ahmad-sh7 Feb 10, 2024
7b7c988
add features of file mappings to feature model
Ahmad-sh7 Feb 12, 2024
58dd2a3
feature trace of source asset created
Ahmad-sh7 Feb 12, 2024
fd444ad
store feature traces of file assets
Ahmad-sh7 Feb 14, 2024
82dc6b5
store feature traces of class and method assets
Ahmad-sh7 Feb 14, 2024
2bc10a7
code refactoring
Ahmad-sh7 Feb 14, 2024
8b14697
remove reset method from pasting
Ahmad-sh7 Feb 15, 2024
173350d
packages refactored and propagating package created
Ahmad-sh7 Feb 21, 2024
d4a2ecf
traced folder mapping features
Ahmad-sh7 Feb 21, 2024
1088a21
Test method implemented
Ahmad-sh7 Feb 22, 2024
0de3d72
listen to virtual file system copies
Ahmad-sh7 Feb 22, 2024
c4bb7cb
trace detected for file copying
Ahmad-sh7 Feb 26, 2024
bc285ff
fix bug
Ahmad-sh7 Feb 26, 2024
114646f
listen to copies of method and class asset types
Ahmad-sh7 Feb 26, 2024
e97af80
listen to copies of method and class asset types
Ahmad-sh7 Feb 29, 2024
e585ce1
trace saved of method and class fragments
Ahmad-sh7 Mar 1, 2024
b27deba
get feature implementation in copied assets
Ahmad-sh7 Mar 4, 2024
583b2c5
notification editor panel created
Ahmad-sh7 Mar 5, 2024
1dc4793
listen to file changes
Ahmad-sh7 Mar 6, 2024
94247b3
project service initialization deleted
Ahmad-sh7 Mar 9, 2024
ff6b086
listen and store folder copies
Ahmad-sh7 Mar 9, 2024
1194ba3
folder asset traces implemented
Ahmad-sh7 Mar 11, 2024
9d970f5
folder asset feature traces implemented
Ahmad-sh7 Mar 11, 2024
86cd849
assets management setting page created
Ahmad-sh7 Mar 13, 2024
8767445
settings with preference key implemented
Ahmad-sh7 Mar 13, 2024
0186c4a
show editor panel on file changes
Ahmad-sh7 Mar 14, 2024
37171eb
refactoring and assetsManagement feature added
Ahmad-sh7 Mar 15, 2024
0b9abdd
fix bug
Ahmad-sh7 Mar 15, 2024
488d0e3
fix bugs
Ahmad-sh7 Mar 15, 2024
1a3d55b
track feature mappings in feature to folder files
Ahmad-sh7 Mar 15, 2024
0087866
added feature number to feature cloning
Ahmad-sh7 Mar 18, 2024
c65e5cf
refactoring
Ahmad-sh7 Mar 18, 2024
ba37a32
some code warnings handled
Ahmad-sh7 Mar 18, 2024
62e6e3b
modify notify text
Ahmad-sh7 Mar 20, 2024
8608c18
preference page extended
Ahmad-sh7 Mar 21, 2024
6fc0b16
unAssigned in feature trace added
Ahmad-sh7 Mar 22, 2024
a76ffab
merge window added
Ahmad-sh7 Mar 22, 2024
c128834
relative paths stored
Ahmad-sh7 Mar 23, 2024
187f8a2
fix
Ahmad-sh7 Mar 24, 2024
33a8093
project name traced for only external projects
Ahmad-sh7 Mar 29, 2024
b7d2c53
main merged
Ahmad-sh7 Mar 29, 2024
79771a7
clean up
Ahmad-sh7 Mar 29, 2024
0eca280
test class created
Ahmad-sh7 Apr 5, 2024
eadbcb7
test
Ahmad-sh7 Apr 6, 2024
674a627
test
Ahmad-sh7 Apr 8, 2024
a45c5b5
test
Ahmad-sh7 Apr 9, 2024
0d518ec
test
Ahmad-sh7 Apr 9, 2024
12b32a4
test
Ahmad-sh7 Apr 10, 2024
7209154
test
Ahmad-sh7 Apr 12, 2024
cfdd58f
test
Ahmad-sh7 Apr 12, 2024
6ebd1d0
test
Ahmad-sh7 Apr 13, 2024
ffb279b
test
Ahmad-sh7 Apr 13, 2024
ffe4a9e
test
Ahmad-sh7 Apr 14, 2024
594e93f
test
Ahmad-sh7 Apr 14, 2024
d0dafae
test
Ahmad-sh7 Apr 16, 2024
0e65c69
test
Ahmad-sh7 Apr 23, 2024
e7dd2ad
test
Ahmad-sh7 Apr 23, 2024
7f5c740
refactor test package
Ahmad-sh7 Apr 23, 2024
2fea02f
refactor test method names
Ahmad-sh7 Apr 24, 2024
4edf034
fix
Ahmad-sh7 May 2, 2024
c489947
Merge branch 'main' into feature/vpIntegration-cloning
Ahmad-sh7 May 3, 2024
31171b6
CHANGELOG and CONTRIBUTORS updated
Ahmad-sh7 May 3, 2024
1aa9823
fix and refactor
Ahmad-sh7 May 6, 2024
48c748a
fix editor notification message
Ahmad-sh7 Jun 14, 2024
5b01408
git user name added to trace
Ahmad-sh7 Jul 6, 2024
27b2c3f
Merge branch 'refs/heads/main' into feature/vpIntegration-cloning
johmara Aug 8, 2024
0d4db36
merge main
johmara Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .feature-model
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ HAnS
NewFile
Quickfix
SettingsPage

CloneManagement
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Thumbs.db
*.flv
*.mov
*.wmv

trace-db.txt
.gradle/
build/

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Added

- Added a View of the metrics to the project
- Added a clone management tool with a preference page

### Fixed

Expand Down
20 changes: 10 additions & 10 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
| Code Contributor | [![isselab github](https://img.shields.io/badge/GitHub-isselab-181717.svg?style=flat&logo=github)](https://www.github.com/isselab) |
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| Johan Martinson | [![Johan github](https://img.shields.io/badge/GitHub-johmara-181717.svg?style=flat&logo=github)](https://www.github.com/johmara) |
| Code Contributor | [![isselab github](https://img.shields.io/badge/GitHub-isselab-181717.svg?style=flat&logo=github)](https://www.github.com/isselab) |
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| Johan Martinson | [![Johan github](https://img.shields.io/badge/GitHub-johmara-181717.svg?style=flat&logo=github)](https://www.github.com/johmara) |
| Herman Jansson | [![Herman github](https://img.shields.io/badge/GitHub-janssonherman-181717.svg?style=flat&logo=github)](https://www.github.com/janssonherman) |
| Fadi Abunaj | [![Fadi github](https://img.shields.io/badge/GitHub-Civilangem0-181717.svg?style=flat&logo=github)](https://www.github.com/Civilangem0) |
| Love Rymo | [![Love github](https://img.shields.io/badge/GitHub-Love--Ry1-181717.svg?style=flat&logo=github)](https://www.github.com/Love-Ry1) |
| David Stechow | [![David github](https://img.shields.io/badge/GitHub-HerrKermet-181717.svg?style=flat&logo=github)](https://www.github.com/HerrKermet) |
| Philipp Kusmierz | [![Philipp github](https://img.shields.io/badge/GitHub-Kuzzi04-181717.svg?style=flat&logo=github)](https://www.github.com/Kuzzi04) |
| Mariana Hohashvili | [![Mariana github](https://img.shields.io/badge/GitHub-hohashvili-181717.svg?style=flat&logo=github)](https://www.github.com/hohashvili) |
| Luca Kramer | [![Luca github](https://img.shields.io/badge/GitHub-LucaKramer-181717.svg?style=flat&logo=github)](https://www.github.com/LucaKramer) |

| Fadi Abunaj | [![Fadi github](https://img.shields.io/badge/GitHub-Civilangem0-181717.svg?style=flat&logo=github)](https://www.github.com/Civilangem0) |
| Love Rymo | [![Love github](https://img.shields.io/badge/GitHub-Love--Ry1-181717.svg?style=flat&logo=github)](https://www.github.com/Love-Ry1) |
| David Stechow | [![David github](https://img.shields.io/badge/GitHub-HerrKermet-181717.svg?style=flat&logo=github)](https://www.github.com/HerrKermet) |
| Philipp Kusmierz | [![Philipp github](https://img.shields.io/badge/GitHub-Kuzzi04-181717.svg?style=flat&logo=github)](https://www.github.com/Kuzzi04) |
| Mariana Hohashvili | [![Mariana github](https://img.shields.io/badge/GitHub-hohashvili-181717.svg?style=flat&logo=github)](https://www.github.com/hohashvili) |
| Luca Kramer | [![Luca github](https://img.shields.io/badge/GitHub-LucaKramer-181717.svg?style=flat&logo=github)](https://www.github.com/LucaKramer) |
| Ahmad Al Shihabi | [![Ahmad github](https://img.shields.io/badge/GitHub-Ahmadsh7-181717.svg?style=flat&logo=github)](https://github.com/Ahmad-sh7) |


| Project Contributors | [![isselab github](https://img.shields.io/badge/GitHub-isselab-181717.svg?style=flat&logo=github)](https://www.github.com/isselab) |
Expand Down
11 changes: 6 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.changelog.Changelog // Gradle Changelog Plugin
import org.jetbrains.changelog.markdownToHTML // Gradle Changelog Plugin
import org.jetbrains.intellij.platform.gradle.TestFrameworkType // Gradle IntelliJ Plugin
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.Constants.Constraints
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
Expand Down Expand Up @@ -116,7 +117,7 @@ intellijPlatform {
password = environment("PRIVATE_KEY_PASSWORD")
}

verifyPlugin {
pluginVerification {
ides {
recommended()
}
Expand Down Expand Up @@ -163,6 +164,6 @@ val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
}

plugins {
robotServerPlugin()
robotServerPlugin(Constraints.LATEST_VERSION)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ platformTypes = IC,RD
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins =
platformBundledPlugins = com.intellij.java

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.9
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package se.isselab.HAnS.assetsManagement;

import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.application.ApplicationManager;

import javax.swing.*;
import java.awt.*;

public class CloneManagementSettingsComponent {
private JPanel myMainPanel;

Check warning on line 10 in src/main/java/se/isselab/HAnS/assetsManagement/CloneManagementSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field can be local

Field can be converted to a local variable

Check warning on line 10 in src/main/java/se/isselab/HAnS/assetsManagement/CloneManagementSettingsComponent.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Field can be local

Field can be converted to a local variable
private JCheckBox cloningOption;
private JCheckBox propagatingOption;
private JCheckBox showCloneOption;
public static PropertiesComponent properties = PropertiesComponent.getInstance();
private String selected = "none";
private boolean initialized = false;
public static CloneManagementSettingsComponent getInstance(){
return ApplicationManager.getApplication().getService(CloneManagementSettingsComponent.class);
}

public JComponent getPanel() {
myMainPanel = new JPanel(new GridLayout(0, 1));
cloningOption = new JCheckBox("Enable Clone Tracing");
showCloneOption = new JCheckBox("Show Clone Information");
propagatingOption = new JCheckBox("Notify on Sources Segment Changes");
myMainPanel.add(cloningOption);
myMainPanel.add(showCloneOption);
myMainPanel.add(propagatingOption);
return myMainPanel;
}

public boolean isModified() {
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
if(!initialized){
init();
initialized = true;
return false;
}
selected = "none";
setSelected();
String current = settingsState.prefKey;
return !selected.equals(current);
}

public void apply() {
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
setSelected();
settingsState.prefKey = selected;
}

public void setSelected(){
if(cloningOption.isSelected() && propagatingOption.isSelected() && showCloneOption.isSelected()){
selected = "All";
}if(cloningOption.isSelected() && !propagatingOption.isSelected()&& !showCloneOption.isSelected()){
selected = "clone";
}if(!cloningOption.isSelected() && propagatingOption.isSelected()&& !showCloneOption.isSelected()){
selected = "propagate";
}if(!cloningOption.isSelected() && !propagatingOption.isSelected()&& !showCloneOption.isSelected()){
selected = "none";
}if(!cloningOption.isSelected() && !propagatingOption.isSelected() && showCloneOption.isSelected()){
selected = "showClone";
}if(cloningOption.isSelected() && !propagatingOption.isSelected() && showCloneOption.isSelected()){
selected = "cloneAndShowClone";
}if(cloningOption.isSelected() && propagatingOption.isSelected() && !showCloneOption.isSelected()){
selected = "cloneAndPropagate";
}if(!cloningOption.isSelected() && propagatingOption.isSelected() && showCloneOption.isSelected()){
selected = "showCloneAndPropagate";
}
}

public void reset() {
cloningOption.setSelected(false);
showCloneOption.setSelected(false);
propagatingOption.setSelected(false);
}
public void init() {
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
switch(settingsState.prefKey) {
case "All":
cloningOption.setSelected(true);
showCloneOption.setSelected(true);
propagatingOption.setSelected(true);
break;
case "clone":
cloningOption.setSelected(true);
showCloneOption.setSelected(false);
propagatingOption.setSelected(false);
break;
case "showClone":
cloningOption.setSelected(false);
showCloneOption.setSelected(true);
propagatingOption.setSelected(false);
break;
case "propagate":
cloningOption.setSelected(false);
showCloneOption.setSelected(false);
propagatingOption.setSelected(true);
break;
case "cloneAndShowClone":
cloningOption.setSelected(true);
showCloneOption.setSelected(true);
propagatingOption.setSelected(false);
break;
case "cloneAndPropagate":
cloningOption.setSelected(true);
showCloneOption.setSelected(false);
propagatingOption.setSelected(true);
break;
case "showCloneAndPropagate":
cloningOption.setSelected(false);
showCloneOption.setSelected(true);
propagatingOption.setSelected(true);
break;
default:
cloningOption.setSelected(false);
showCloneOption.setSelected(false);
propagatingOption.setSelected(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package se.isselab.HAnS.assetsManagement;

import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.util.NlsContexts;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class CloneManagementSettingsConfigurable implements Configurable {
private CloneManagementSettingsComponent cloneManagementSettingsComponent;
@Override
public @NlsContexts.ConfigurableName String getDisplayName() {
return "Clone Management";
}

@Override
public @Nullable JComponent createComponent() {
cloneManagementSettingsComponent = new CloneManagementSettingsComponent();
return cloneManagementSettingsComponent.getPanel();
}

@Override
public boolean isModified() {
return cloneManagementSettingsComponent.isModified();
}

@Override
public void apply() throws ConfigurationException {
cloneManagementSettingsComponent.apply();
}

@Override
public void reset() {
cloneManagementSettingsComponent.reset();
}

@Override
public void disposeUIResources() {
cloneManagementSettingsComponent = null;
}

@Override
public void cancel() {
Configurable.super.cancel();
}

public CloneManagementSettingsComponent getCloneManagementSettingsComponent() {
return this.cloneManagementSettingsComponent;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package se.isselab.HAnS.assetsManagement;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@State(
name = "se.isselab.HAnS.assetsManagement.CloneManagementSettingsState",
storages = @Storage("plugin.xml")
)
public class CloneManagementSettingsState implements PersistentStateComponent<CloneManagementSettingsState> {
public String prefKey = "none";
@Override
public @Nullable CloneManagementSettingsState getState() {
return this;
}

@Override
public void loadState(@NotNull CloneManagementSettingsState state) {

}
public static CloneManagementSettingsState getInstance() {
return ApplicationManager.getApplication().getService(CloneManagementSettingsState.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CloneManagement
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2024 Ahmad Al Shihabi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package se.isselab.HAnS.assetsManagement.cloneManagement;

import com.intellij.psi.*;
import se.isselab.HAnS.assetsManagement.CloneManagementSettingsComponent;

Check warning on line 19 in src/main/java/se/isselab/HAnS/assetsManagement/cloneManagement/AssetsAndFeatureTraces.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import

Unused import `import se.isselab.HAnS.assetsManagement.CloneManagementSettingsComponent;`

Check warning on line 19 in src/main/java/se/isselab/HAnS/assetsManagement/cloneManagement/AssetsAndFeatureTraces.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import

Unused import `import se.isselab.HAnS.assetsManagement.CloneManagementSettingsComponent;`
import se.isselab.HAnS.assetsManagement.CloneManagementSettingsState;

import java.util.ArrayList;

public class AssetsAndFeatureTraces {
public static PsiMethod clonedMethod;
public static PsiClass clonedClass;
public static String sourceProjectName;

public static String sourcePath;
public static ArrayList<String> subFeatureTrace;
public static ArrayList<PsiElement> featuresAnnotations;

public static void resetAssetClones() {
clonedClass = null;
clonedMethod = null;
sourceProjectName = null;
sourcePath = null;
}
public static void resetTraces() {
subFeatureTrace = null;
featuresAnnotations = null;
FeaturesCodeAnnotations.getInstance().clearFeatures();
}
public static boolean isAllPreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("All");
}
public static boolean isClonePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("clone");
}
public static boolean isPropagatePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("propagate"); }
public static boolean isShowClonePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("showClone"); }
public static boolean isCloneAndPropagatePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("cloneAndPropagate"); }
public static boolean isCloneAndShowClonePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("cloneAndShowClone"); }
public static boolean isShowCloneAndPropagatePreference(){
CloneManagementSettingsState settingsState = CloneManagementSettingsState.getInstance();
return settingsState.prefKey.equals("showCloneAndPropagate"); }
}
Loading
Loading