CPD Results

The following document contains the results of PMD's CPD 4.2.2.

Duplications

File Project Line
org/eparapher/rcp/actions/CMSSignDocumentAction.java eParapher Client RCP 103
org/eparapher/rcp/actions/ToPDFAndSignDocumentAction.java eParapher Client RCP 101
	}

	private File[] getFileSelectionFromView() {

		ArrayList<File> fileList = new ArrayList<File>();
		
		if (viewer.getSelection()!=null && !viewer.getSelection().isEmpty()) {
			// Iterate over selected file in view
			ISelection selection = viewer.getSelection();
			IStructuredSelection structselection = (IStructuredSelection) selection;
			
			//Build File Array from Table Selection
			for (Iterator<Object> iterator = structselection.iterator(); iterator.hasNext();) {
				Object obj =  iterator.next();
				if (obj instanceof TreeParent)
					//TODO : sign all files in a directory (if confirm?)
					eParapherTools.debugMessage("Cannot sign a directory!");
				else {
					TreeObject to = (TreeObject) obj;
					File f = new File(to.getFilePath());
					if (!f.exists())
						log.error("file " + to.getFilePath() + " has been deleted");
					else
						fileList.add(f);
				}
			}
		}
		return fileList.toArray(new File[] {});
	}

	public void dispose() {
	}

	class XMLSignJob extends Job {

File Project Line
org/eparapher/rcp/tools/CertificateView.java eParapher Client RCP 141
org/eparapher/rcp/wizards/KeysAndCertificateSelectionPage.java eParapher Client RCP 163
				if (index==7)
					return certchain.getKeystoreAlias();
				return "";
			}
			userCert = certchain.getCertificateChain()[0];
			
			switch (index) {
				case 0:	return "";
				case 1: return certchain.getKeystoreAlias();
				case 2: return CertificateInfo.getSubjectAsShortText(userCert);
				case 3: return CertificateInfo.getNotBeforeAsText( userCert ) + " to " + CertificateInfo.getNotAfterAsText( userCert );
				case 4: return CertificateInfo.getPublicKeyInfo( userCert.getPublicKey() );
				default: break;
			}
			return "";
		}
		public Image getColumnImage(Object obj, int index) {
			if (index == 0)
				return getImage(obj);
			return null;
		}
		
		public Image getImage(Object obj) {
			KeystoreEntry certchain = (KeystoreEntry) obj;
			if (certchain.getKeystoreAlias().equals(defaultAlias)) {

File Project Line
org/eparapher/rcp/views/CryptoProvidersView.java eParapher Client RCP 244
org/eparapher/rcp/views/documents/SecuredDocumentsView.java eParapher Client RCP 391
				SecuredDocumentsView.this.fillContextMenu(manager);
			}
		});
		Menu menu = menuMgr.createContextMenu(viewer.getControl());
		viewer.getControl().setMenu(menu);
		getSite().registerContextMenu(menuMgr, viewer);
	}

	private void contributeToActionBars() {
		IActionBars bars = getViewSite().getActionBars();
		fillLocalPullDown(bars.getMenuManager());
		fillLocalToolBar(bars.getToolBarManager());
	}
	
	private void fillLocalToolBar(IToolBarManager manager) {
		manager.add(refreshAction);
		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
		drillDownAdapter.addNavigationActions(manager);
	}

	private void fillLocalPullDown(IMenuManager manager) {

File Project Line
org/eparapher/rcp/views/ASN1Viewer.java eParapher Client RCP 196
org/eparapher/rcp/views/CryptoProvidersView.java eParapher Client RCP 166
			log.debug("Refreshing directories finished");
		}
		public Object getParent(Object child) {
			if (child instanceof TreeObject) {
				return ((TreeObject)child).getParent();
			}
			return null;
		}
		public Object [] getChildren(Object parent) {
			if (parent instanceof TreeParent) {
				return ((TreeParent)parent).getChildren();
			}
			return new Object[0];
		}
		public boolean hasChildren(Object parent) {
			if (parent instanceof TreeParent)
				return ((TreeParent)parent).hasChildren();
			return false;
		}
		/*
		 * We set up a dummy model to initialize tree heararchy.
		 * In a real code, you will connect to a real model and
		 * expose its hierarchy.
		 */
		private void initialize() {